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

Crazy Lazy

描述

Warning: Crazy Lazy has reached end of life. WordPress 5.5+ supports lazy-loading of images in Core based on the native HTML loading attribute. If you look for an alternative plugin, we recommend to use Lazy Loader instead.

Crazy Lazy helps increasing the performance of your blog or website by displaying images efficiently. When a page would usually display some images, Crazy Lazy will prevent those images to load. Only when a user scrolls down the page and reaches the position where an image actually should be displayed, that particular image will be loaded from the server.

By loading images only when needed, Crazy Lazy will reducing page loading times and (potentially costly) traffic.

This Lazy Load plugin is structured very lean and does not require any settings: activate, done. Depending on the theme or the usage of jQuery Crazy Lazy optionally will utilze a modified version of the jQuery plugin Unveil.js, or the native JavaScript library lazyload.js.

Styling

Placeholders for images can be styled, i.e. like this:

img[src*='data:image/gif;base64'] {
    border: 1px dashed #dbdbdb;
}

img.crazy_lazy {
    background: url(/wp-includes/images/wpspin-2x.gif) no-repeat center center;
    background-size: 16px 16px;
}

Excluding images

It’s possible to exclude some images from the lazy loading. This can be achieved by adding a data attribute data-crazy-lazy="exclude" or data-skip-lazy to the images that should not lazy loaded by the plugin.
Alternatively you can add a CSS class crazy_lazy or skip-lazy. These CSS classes can also be added to the image block.

Support

Contribute

  • Active development of this plugin is handled on GitHub.
  • Pull requests for documented bugs are highly appreciated.
  • If you think you’ve found a bug (e.g. you’re experiencing unexpected behavior), please post at the support forums first.
  • If you want to help us translate this plugin you can do so on WordPress Translate.

Credits

安装

  • If you don’t know how to install a plugin for WordPress, here’s how.

常见问题

Will this plugin lazy load all the images on a page?

All images that have been uploaded into your media library, including featured images.

Will I have to edit any theme template files to make this work?

Usually no. If Crazy Lazy doesn’t work out of the box, check your active theme’s footer.php template file. There should be a line calling wp_footer() in it which is required for Crazy Lazy to work properly.

Will Crazy Lazy work well with any caching plugins?

Crazy Lazy will work with every caching plugin, including our own Cachify.

评价

2017年12月15日
funciona super bem e gostei muito de ter essa opção no meu blog
2016年9月3日
Please consider to support more lazy on videos, widgets, text, etc
阅读所有15条评价

贡献者及开发者

“Crazy Lazy” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

“Crazy Lazy”插件已被翻译至2种本地话语言。 感谢所有译者为本插件所做的贡献。

将“Crazy Lazy”翻译成您的语言。

对开发感兴趣吗?

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

更新日志

1.2.0

  • Fix PHP warning due to undefined index (#37, #38) – thanks to Rouven Hurling
  • Add EOL notice to the admin area recommending Lazy Loader as an alternative

1.1.0

  • add support for image block using a skip-class

1.0.5

  • add support for new skip data attribute “data-skip-lazy” and CSS class “skip-lazy”

1.0.4

  • fixed duplicate replacements of a single image

1.0.3

  • fixed some cases with HTML attributes not being closed correctly

1.0.2

  • fixed an unescaped slash in the regular expression

1.0.1

  • fixed a formatting error in the regular expression replacement

1.0.0

  • new regex to match images and preventing duplicate replacements
  • added an option to exclude images from lazy loading by using a special attribute

0.1.0

  • fixed a bug in the regex

0.0.9.2

0.0.9.1

  • Removed support for WordPress’ native galleries after some users had reported issues

0.0.9

  • WordPress 4.0 Support
  • Lazy Loading for WordPress-image-gallery

0.0.8

  • Smooth fadein of images
  • Unveil.js-library modifications

0.0.7

  • Support of more formats for the img-tags

0.0.6

  • Hot Fix for faulty WordPress-function wp_script_is

0.0.5