Changeset 89816 in spip-zone


Ignore:
Timestamp:
May 31, 2015, 7:17:13 PM (6 years ago)
Author:
arno@…
Message:

Bug sur la gestion des lazy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/image_responsive/javascript/image_responsive.js

    r89815 r89816  
    196196}
    197197
    198 
    199 function calculer_top_image_responsive(this_img) {
     198function calculer_top_image_responsive() {
     199        // Calculer le "top" des images lazy
     200        $(".lazy, [data-lazy]").each(function() {
     201                _calculer_top_image_responsive($(this));
     202        });
     203       
     204        charger_image_responsive();
     205}
     206
     207function _calculer_top_image_responsive(this_img) {
    200208        var offset = this_img.offset().top;
    201         if (scrollT) offset = offset + scrollT;
    202209        this_img.attr("data-top", offset).addClass("lazy");
    203210}
     
    209216        if (scrollT) var sTop = scrollT;
    210217        else var sTop = $(window).scrollTop();
     218       
     219        console.log(sTop);
    211220       
    212221        var hauteur = $(window).height();
     
    235244
    236245function _charger_image_responsive () {
    237         // Calculer le "top" des images lazy
    238         $(".lazy, [data-lazy]").each(function() {
    239                 calculer_top_image_responsive($(this));
    240         });
    241246       
    242247        // Remplacer les URL non lazy
     
    251256
    252257}
    253 var timeout_charger_image_responsive;
    254 $(document).ready(function() {
    255         charger_image_responsive();
    256 });
    257 // Plus rattrapage:
    258 $(document).on("ajaxComplete", charger_image_responsive);
    259 
    260 $(window).on("load",charger_image_responsive);
    261 $(window).smartresize(charger_image_responsive);
     258
     259$(document).ready(calculer_top_image_responsive);
     260$(window).smartresize(calculer_top_image_responsive);
     261$(window).on("load",calculer_top_image_responsive);
     262$(document).on("ajaxComplete", calculer_top_image_responsive);
     263
     264
     265
    262266$(window).on("scroll touchmove", charger_image_responsive);
    263267       
Note: See TracChangeset for help on using the changeset viewer.