Linux 软件免费装

Lazy Load

开发者 batmoo
automattic
jakemgold
10up
更新时间 2021年7月9日 03:50
PHP版本: 3.2 及以上
WordPress版本: 5.0

标签

images lazy load front-end optimization

下载

0.1 0.2 0.3 0.4 0.5 0.6 0.6.1

详情介绍:

Lazy load images to improve page load times. Uses jQuery.sonar to only load an image when it's visible in the viewport. This plugin is an amalgamation of code written by the WordPress.com VIP team at Automattic, the TechCrunch 2011 Redesign team, and Jake Goldman (10up LLC). Uses jQuery.sonar by Dave Artz (AOL).

安装:

  1. Upload the plugin to your plugins directory
  2. 通过WordPress的“插件”菜单激活插件
  3. Enjoy!

常见问题:

How do I change the placeholder image

add_filter( 'lazyload_images_placeholder_image', 'my_custom_lazyload_placeholder_image' ); function my_custom_lazyload_placeholder_image( $image ) { return 'http://url/to/image'; }

How do I lazy load other images in my theme?

You can use the lazyload_images_add_placeholders helper function: if ( function_exists( 'lazyload_images_add_placeholders' ) ) $content = lazyload_images_add_placeholders( $content ); Or, you can add an attribute called "data-lazy-src" with the source of the image URL and set the actual image URL to a transparent 1x1 pixel. You can also use output buffering, though this isn't recommended: if ( function_exists( 'lazyload_images_add_placeholders' ) ) ob_start( 'lazyload_images_add_placeholders' ); This will lazy load all your images.

更新日志:

0.6.1 0.6 0.5 0.4 0.3 0.2 0.1