Sha256: ceeb1c0fd07fccf04ab1f7ff67238835b6d32621287a200dd1a09c89b755265e

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

(function($) {

  // Input: Array of JSON objects {selector, offset, callback}

  scrollFire = function(options) {
    $(window).scroll(function () {
      var windowScroll = $(window).scrollTop() + $(window).height();

      $.each( options, function( i, value ){
        var selector = value.selector,
            offset = value.offset,
            callback = value.callback;

        var elementOffset = $(selector).offset().top;

        if (windowScroll > (elementOffset + offset)) {
          if ($(selector).data('done') === undefined) {
            var callbackFunc = new Function(callback);
            callbackFunc();

            $(selector).data('done', true);
          }
        }

      });
    });
  }

})(jQuery);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
materialize-sass-0.95.3.2 app/assets/javascripts/materialize/scrollFire.js
materialize-sass-0.95.3.1 app/assets/javascripts/materialize/scrollFire.js
materialize-sass-0.95.3 app/assets/javascripts/materialize/scrollFire.js
materialize-sass-0.95.2 app/assets/javascripts/materialize/scrollFire.js