Page 1 of 1

code understanding

Posted: Mon Nov 10, 2014 11:38 pm
by gautamz07
the following is code from a Jquery pluggin , i have commented out my difficulties .

Code: Select all

    function unveil() {
      var inview = images.filter(function() {
        var $e = $(this);
        if ($e.is(":hidden")) return;

        var wt = $w.scrollTop(),
             $w = $(window),
            wb = wt + $w.height(),
            et = $e.offset().top,
            eb = et + $e.height();

        return eb >= wt - th && et <= wb + th;  // what is this math all about really ?? 
      });

      loaded = inview.trigger("unveil"); // What is happening on these 2 lines ??
      images = images.not(loaded);
    }

    $w.on("scroll.unveil resize.unveil lookup.unveil", unveil);  // i understand the onfunction , but what is "scroll.unveil resize.unveil lookup.unveil" ??