Linux 软件免费装

Plugin Name

开发者 omac
更新时间 2019年3月2日 00:25
捐献地址: 去捐款
PHP版本: 2.8.0 及以上
WordPress版本: 5.1.0
版权: GPLv2 or later
版权网址: 版权信息

标签

Plugin Images Loading Lazy

下载

1.0 1.1 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.4.0 2.0.0 2.0.5

详情介绍:

A simple plugin to enable lazy loading for all images using WordPress image functions, or embedded into posts and pages using the WordPress dashboard. The plugin works by replacing the original image source with a blank transparent gif via datauri. Reducing page load speed, network requests, and saving bandwidth for host and visitors unless they scroll where an image is in view. The plugin makes use of the fantastic lazysizes javascript library.

安装:

This section describes how to install the plugin and get it working.
  1. Upload the plugin files to the /wp-content/plugins/wp-lazy-loaded-images directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress
  3. That's it! It should automatically replace images used inside of posts / pages (where passed through properly in themes), plugins, and more.

常见问题:

How can I change the default placeholder color?

As of 2.0.0, Images now load as a transparent gif, which should remove the need to add custom image colors, and make it work in more situations automatically.

Fade in images as they load

With the new lazy load library, a few helper CSS classes are included by default. The full documentation can be found here, but the gist of it [pulled from the github repo] is as follows: / fade image in after load / .lazyload, .lazyloading { opacity: 0; } .lazyloaded { opacity: 1; transition: opacity 300ms; }

Fallback

As of 1.4.0, the plugin also adds support for a noscript fallback so the images will appear in browsers that might have Javascript disabled. To take full advantage of this, the plugin provides a fully automatic solution using the following filter to your functions.php, add_filter( 'lazy_load_enable_fallback', '__return_true' ). This method will automatically handle all of the below instructions. If you're developing a custom theme you might want to include the following instructions manually, in that case you can use add_filter( 'lazy_load_enable_noscript', '__return_true' ) to only add the <noscript> tags and leave the styles, javascript, and body classes untouched. NOTE: This fallback only works on the images that are replaced inside the body of the pages, and those generated by using the_post_thumbnail. Add the following CSS: .no-js .lazyload.lazy-fallback { display: none; } Add the following JS inside as close to the opening body tag as possible: var body = document.getElementsByTagName('body')[0]; if (body != undefined) { body.setAttribute('class', body.getAttribute('class').replace('no-js', '')); } And append this snippet to your functions.php: add_filter( 'body_class', function ( $classes, $class ) { if ( ! in_array( 'no-js', $classes ) ) { $classes[] = 'no-js'; } return $classes; }, 10, 2 );

更新日志:

2.0.1 - 2.0.5 2.0.0 1.4.0 1.3.2 1.3.0 1.2.0 1.1 1.0