Sha256: 9818567ba532ca70370077bb19961be2b7c8bffdead4d49fc6fe71a42c18fa51

Contents?: true

Size: 1.53 KB

Versions: 10

Compression:

Stored size: 1.53 KB

Contents

Materialize={};Materialize.guid=(function(){function s4(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return function(){return s4()+s4()+"-"+s4()+"-"+s4()+"-"+s4()+"-"+s4()+s4()+s4()}})();(function($){$.fn.pushpin=function(options){var defaults={top:0,bottom:Infinity,offset:0};if(options==="remove"){this.each(function(){if(id=$(this).data("pushpin-id")){$(window).off("scroll."+id);$(this).removeData("pushpin-id").removeClass("pin-top pinned pin-bottom").removeAttr("style")}});return false}options=$.extend(defaults,options);$index=0;return this.each(function(){var $uniqueId=Materialize.guid(),$this=$(this),$original_offset=$(this).offset().top;function removePinClasses(object){object.removeClass("pin-top");object.removeClass("pinned");object.removeClass("pin-bottom")}function updateElements(objects,scrolled){objects.each(function(){if(options.top<=scrolled&&options.bottom>=scrolled&&!$(this).hasClass("pinned")){removePinClasses($(this));$(this).css("top",options.offset);$(this).addClass("pinned")}if(scrolled<options.top&&!$(this).hasClass("pin-top")){removePinClasses($(this));$(this).css("top",0);$(this).addClass("pin-top")}if(scrolled>options.bottom&&!$(this).hasClass("pin-bottom")){removePinClasses($(this));$(this).addClass("pin-bottom");$(this).css("top",options.bottom-$original_offset)}})}$(this).data("pushpin-id",$uniqueId);updateElements($this,$(window).scrollTop());$(window).on("scroll."+$uniqueId,function(){var $scrolled=$(window).scrollTop()+options.offset;updateElements($this,$scrolled)})})}}(jQuery));

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jekyll-theme-mdui-0.4.8 assets/js/pushpin.js
jekyll-theme-mdui-0.4.7 assets/js/pushpin.js
jekyll-theme-mdui-0.4.6 assets/js/pushpin.js
jekyll-theme-mdui-0.4.5 assets/js/pushpin.js
jekyll-theme-mdui-0.4.2 assets/js/pushpin.js
jekyll-theme-mdui-0.4.1 assets/js/pushpin.js
jekyll-theme-mdui-0.4.0 assets/js/pushpin.js
jekyll-theme-mdui-0.3.0 assets/js/pushpin.js
jekyll-theme-mdui-0.2.5 assets/js/pushpin.js
jekyll-theme-mdui-0.2.4 assets/js/pushpin.js