Sha256: a1794354130444e5e922e4211862420bdca9a003ee5e8cb58736e42515f0b5ab
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
// CLASSYLOADER // ----------------------------------- (function(window, document, $, undefined){ $(function(){ var $scroller = $(window), inViewFlagClass = 'js-is-in-view'; // a classname to detect when a chart has been triggered after scroll $('[data-classyloader]').each(initClassyLoader); function initClassyLoader() { var $element = $(this), options = $element.data(); // At lease we need a data-percentage attribute if(options) { if( options.triggerInView ) { $scroller.scroll(function() { checkLoaderInVIew($element, options); }); // if the element starts already in view checkLoaderInVIew($element, options); } else startLoader($element, options); } } function checkLoaderInVIew(element, options) { var offset = -20; if( ! element.hasClass(inViewFlagClass) && $.Utils.isInView(element, {topoffset: offset}) ) { startLoader(element, options); } } function startLoader(element, options) { element.ClassyLoader(options).addClass(inViewFlagClass); } }); })(window, document, window.jQuery);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
radius-rails-3.1.4 | app/assets/javascripts/radius-theme/modules/classyloader.js |