该插件尚未通过WordPress的最新3个主要版本进行测试。 当与较新版本的WordPress一起使用时,可能不再受到维护或支持,并且可能会存在兼容性问题。

Genesis JS / No JS

描述

Make front end styling easier for child themes on the Genesis Framework based on whether JavaScript is enabled or not.

Adds a no-js body class to the front end, and a script on genesis_before which immediately changes the class to js if JavaScript is enabled.
This is how WP does things on the back end, to allow different styles for the same elements depending if JavaScript is active or not.

This plugin is only useful if you’re using a child theme of the Genesis Framework since it uses the genesis_before hook.

安装

Once this plugin is installed and activated, then it will work automatically. There are no options, and nothing to set-up.

Upload

  1. Download the latest tagged archive (choose the “zip” option).
  2. Go to the Plugins -> Add New screen and click the Upload tab.
  3. Upload the zipped archive directly.
  4. Go to the Plugins screen and click Activate.

Manual

  1. Download the latest tagged archive (choose the “zip” option).
  2. Unzip the archive.
  3. Copy the folder to your /wp-content/plugins/ directory.
  4. Go to the Plugins screen and click Activate.

Check out the Codex for more information about installing plugins manually.

Git

Using git, browse to your /wp-content/plugins/ directory and clone this repository:

git clone git@github.com:GaryJones/genesis-js-no-js.git

Then go to your Plugins screen and click Activate.

Composer

composer require gamajo/genesis-js-no-js

常见问题

Installation Instructions

Once this plugin is installed and activated, then it will work automatically. There are no options, and nothing to set-up.

Upload

  1. Download the latest tagged archive (choose the “zip” option).
  2. Go to the Plugins -> Add New screen and click the Upload tab.
  3. Upload the zipped archive directly.
  4. Go to the Plugins screen and click Activate.

Manual

  1. Download the latest tagged archive (choose the “zip” option).
  2. Unzip the archive.
  3. Copy the folder to your /wp-content/plugins/ directory.
  4. Go to the Plugins screen and click Activate.

Check out the Codex for more information about installing plugins manually.

Git

Using git, browse to your /wp-content/plugins/ directory and clone this repository:

git clone git@github.com:GaryJones/genesis-js-no-js.git

Then go to your Plugins screen and click Activate.

Composer

composer require gamajo/genesis-js-no-js
What does this plugin actually do?

If you look at the source of a WordPress back end page, you’ll see it has a body class of no-js. Immediately after the opening body tag is a small script which replaces no-js with js (you can see the amended class with browser developer tools).

WordPress uses this to apply different styles to the same elements, depending on whether JavaScript is present or not.

This plugin recreates the same effect, but for the front end of Genesis Framework child themes.

Shouldn’t the script be at the end of the page?

Usually, yes, but it’s a fairly small script, so does not block rendering of other content for any noticeable length of time.

Doing it immediately also reduces a flash of incorrectly styled content, as the page does not load with no-js styles, then switch to js once everything has finished loading.

评价

2017 年 1 月 31 日 1 回复
Very useful little script for JavaScript feature detection.
阅读所有2条评价

贡献者及开发者

「Genesis JS / No JS」是开源软件。 以下人员对此插件做出了贡献。

贡献者

「Genesis JS / No JS」插件已被翻译至 1 种本地化语言。 感谢所有译者为本插件所做的贡献。

帮助将「Genesis JS / No JS」翻译成简体中文。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

See CHANGELOG.md for all of the changes.