BJ Lazy Load

Descripción

La carga perezosa hace que tu sitio cargue más rápido y ahorra ancho de banda.

Este plugin reemplaza todas las imágenes de tus entradas, miniaturas de entrada, imágenes gravatar e iframes del contenido con un marcador de posición y carga el contenido a medida que se acerca la ventana del navegador cuando el visitante hace scroll en la página. También funciona con los widgets de texto.

Como funciona con iframes, también sirve para vídeos incrustados desde YouTube, Vimeo, etc.

También puedes hacer carga perezosa de imágenes e iframes sde tu tema, usando un sencillo filtro.

Los visitantes sin javascript activo obtienen el elemento original con noscript.

Compatible con el plugin RICG Responsive Images para imágenes adaptables.

Por favor, avísame si hay algún problema. El modo más fácil de obtener respuesta es por Twitter: https://twitter.com/bjornjohansen

Traducciones

  • Russian (ru_RU) por Elvisrk
  • Hebrew (he_IL) por Imri Sagive
  • Polish (pl_PL) por Maciej Gryniuk
  • Norwegian Bokmål (nb_NO) por Bjørn Johansen

El desarrollo se lleva a cabo en GitHub. Las peticiones de modificaciones son bienvenidas.

Uso opcional

Si tienes carga de imágenes en plantillas personalizadas, o quieres hacer carga perezosa de otras imágenes en tu tema, puedes pasar el HTML a través de un filtro:

<?php
$img_html = '<img src="myimage.jpg" alt="">';
$img_html = apply_filters( 'bj_lazy_load_html', $img_html );
echo $img_html;
?>

Nota para desarrolladores: El filtro tiene una prioridad de 10.

Instalación

  1. Descarga y descomprime el plugin
  2. Sube la carpeta ‘bj-lazy-load’ al directorio ‘/wp-content/plugins/’,
  3. Activa el plugin desde el menú ‘Plugins’ de WordPress.

Preguntas frecuentes

Instrucciones de instalación
  1. Descarga y descomprime el plugin
  2. Sube la carpeta ‘bj-lazy-load’ al directorio ‘/wp-content/plugins/’,
  3. Activa el plugin desde el menú ‘Plugins’ de WordPress.
Vaya, este plugin usa JavaScript. ¿Qué pasa con los visitantes sin JS?

No hay de qué preocuparse. Obtienen el elemento original de un elemento noscript. Eso sí, no hay carga perezosa para ellos.

Estoy usando una CDN. ¿Interferirá este plugin?

La carga perezosa funciona bien. Las imágenes siguen cargando desde tu CDN.

¿Cómo puedo verificar que está funcionando el plugin?

Revisa tu código HTML o ve la magia en acción en el inspector web, FireBug o similares.

Reseñas

Slows down load time

It works, except for CSS property background-image, but overall it slows down page load time and initial draw of a page by 3 seconds or more. That is just too much.

Don’t get me wrong, page I was testing this plugin had over 80 images. But that’s is exactly why I want my images to lazy load, so it could work faster. Maybe inline fallback images are to blame, wouldn’t know.

Document / Page load time:
– without: 1.28 / 2.24 seconds
– with: 4.58 / 5.54 seconds

Breaks our portfolio plugin

Not sure if this is directly related to BJ or to Ultimate Portfolio, hence the 3 stars and not 1, but as soon as BJ is turned on images stop loading all together

black bar under images

hello,

I would like to know how to remove the “black bars” and “gray bars” under my images? they appear after I enable the plugin!

Thanks

Leer todas las 80 reseñas

Colaboradores y desarrolladores

“BJ Lazy Load” es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

“BJ Lazy Load” ha sido traducido a 6 idiomas. Gracias a los traductores por sus colaboraciones.

Traduce “BJ Lazy Load” a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN , o suscríbete al log de desarrollo por RSS .

Registro de cambios

Version 1.0.9

  • No genera un tamaño de imagen pequeño a menos que se utilice la vista previa de imagen a baja resolución
  • Marcador de posición por defecto del ajuste de transparencia de la imagen
  • Atributo de tamaños de imagen en carga perezosa para evitar un error de validación w3c
  • Cambia el orden de activación de src y srcset para evitar la carga simultánea de la versión de la imagen original y de la adaptable (por Lucian Florian)

Version 1.0.8

  • Skip classes regex fix
  • Amp compatibility (by mustafauysal)

Version 1.0.7

  • Update sponsored by Bonnier Tidskrifter
  • Fixed issue with srcset not lazy loading (by krispy1298)
  • Compatibility with BadgeOS plugin (by rohitmanglik)
  • WP’s theme style for submit button. (by odie2)
  • Images will now get the lazy-loaded class onload
  • Added optional rudimentary LQIP solution
  • Added working regex for selecting elements to skip

Version 1.0.6

  • Fixed bug when multiple iframes was on the same line of HTML code

Version 1.0.5

  • Added Polish language (by Maciej Gryniuk).
  • Remove leftover console.log() from debugging — oh, crap … I know 🙁

Version 1.0.4

  • We do not touch the feeds

Version 1.0.3

  • Fixed issue where some images wouldn’t be loaded on load under certain conditions.
  • Small performance improvement

Version 1.0.2

  • PHP 5.2 compatibility again

Version 1.0.1

  • Fixes issue with missing placeholder

Version 1.0

  • Internal rewrite. Code cleanup.
  • Supports 3rd party filters
  • Supports most infinite scroll (or content lazy loading) plugins (all that triggers post-load)
  • No more TimThumb
  • No more dependant on 3rd party JS, not even jQuery
  • Removed custom responsice/hidpi image handling in favour of compatibility with the RICG Responsive Images plugin
  • Added translations to Hebrew (he_IL) by Imri Sagive

Version 0.7.5

  • Also applies to text widgets (Thanks to Sigurður Guðbrandsson)

Version 0.7.4

  • Skips lazy loading of data-URIs

Version 0.7.3

  • Works with newlines in the HTML string for the IMG element

Version 0.7.2

  • Re-minified the combined js file for better compability with faulty minifiers

Version 0.7.1

  • Proper encoding of non-ASCII characters in filenames when using responsive or hiDPI images (thanks @testsiteoop)

Version 0.7.0

  • Added meta box to all public post types to exclude BJ Lazy Load for individual posts/pages
  • Placeholder image is replaced with a really short data-uri (thanks @jruizcantero)
  • Added a proper WordPress filter method for arbitrary HTML filtering with: apply_filters( ‘bj_lazy_load_html’, $html )
  • Updated scbFramework to release 58 (no more strict warnings in admin)
  • Updated jQuery.sonar to latest version (as of 2013-11-13)
  • Added POT file (Go translate!)
  • Added translation to Norwegian Bokmål (nb_NO)
  • Added translation to Russian (ru_RU) by Elvisrk

Version 0.6.10

  • Responsive and HiDPI images works with MultiSite subfolders
  • Lazy loading is disabled on Opera Mini
  • Removed leftin print_filters_for() function (sry)
  • User definable threshold

Version 0.6.9

  • Bugfix: Single quotes for the class attribute is now handled (thanks @kReEsTaL)
  • Bugfix: Removed strict error notice (thanks syndrael)

Version 0.6.8

  • Bugfix: sonar.js wouldn’t load properly when SCRIPT_DEBUG was set to true (thanks @techawakening)

Version 0.6.7

  • Combined JS files for faster loading
  • Bugfix for when viewport is resized – now triggering scroll event (thanks @kReEsTaL)

Version 0.6.6

  • Option to disable BJ Lazy Load for MobilePress

Version 0.6.5

  • La carga perezosa de iframes es ahora compatible con los formularios ajax de Gravity Forms.

Version 0.6.4

  • Disable when viewing printable page from WP-Print

Version 0.6.3

  • Detects WPTouch Pro as well

Version 0.6.2

  • Bugfix: Remove notice of undefined constant when SCRIPT_DEBUG isn’t defined

Version 0.6.1

  • Bugfix: The infinite_scroll option wasn’t initialized

Version 0.6.0

  • Optionally serving size optimized images for responsive design/adaptive layout
  • Optionally serving hiDPI images (retina support)
  • Option to disable BJ Lazy Load for WPTouch
  • Fixed issue with infinite scroll (must be enabled on options screen)
  • Upgraded jQuery.sonar to latest version

Version 0.5.4

  • Possible to skip lazy loading of certain images with specified classnames
  • Made the placeholder image override an option setting in wp-admin

Version 0.5.3

  • Added filter: bj_lazy_load_placeholder_url – override placeholder image (should be an option setting in the future)

Version 0.5.2

  • Added the fadeIn effect

Version 0.5.1

  • Lowered jQuery version dependency
  • New options: More granular control on what content to lazy load

Version 0.5.0

  • Complete rewrite
  • Replaced JAIL with jQuery.sonar to accomodate for iframe lazy loading
  • Added lazy loading for iframes
  • The manual filter code now works as it should, lazy loading all images instead of just the first.

Version 0.4.0

  • Upgraded JAIL to version 0.9.9, fixing some bugs. Note: data-href is now renamed data-src.

Version 0.3.3

  • Replaced an anonymous function call causing error in PHP < 5.3

Version 0.3.2

  • The wp_head caller selector was added to the option page

Version 0.3.1

  • Also with d.sturm’s fix (thanks)

Version 0.3.0

  • Added BJLL::filter() so you can lazy load any images in your theme
  • Added the option to load in wp_head() instead (suboptimal, but some themes actually don’t call wp_footer())
  • Correctly removed the lazy loader from feeds

Version 0.2.5

  • Fixes Unicode-issue with filenames

Version 0.2.4

  • Now (more) compliant to the WP coding style guidelines.
  • All strings localized
  • Translations get loaded
  • POT file included (send me your translations)
  • Norwegian translation included

Version 0.2.3

  • Now using DOMDocument for better HTML parsing. Old regexp parsing as fallback if DOMDocument is not available.

Version 0.2.2

  • Added CSS. No longer need for hiding .no-js .lazy
  • Added options whether to include JS and CSS or not

Version 0.2.1

  • Added options: Timeout, effect, speed, event, offset, ignoreHiddenImages
  • Combining the two JS files for faster loading
  • Renamed the plugin file from bj-lazyload.php to bj-lazy-load.php to better fit with the plugin name

Version 0.2

  • Added options panel in admin
  • Added option to lazy load post thumbnails
  • Skipped the lazy loading in feeds

Version 0.1

  • Released 2011-12-05
  • It works (or at least it does for me)