Last active
December 27, 2015 12:09
Revisions
-
DarrylD revised this gist
Nov 5, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ (function(){ var triggerElement = $(".container") //element to he used to trigger the fixed header , header = $(".header") //element of header , stickyClass = "stickit" // class to be used to give the fixed header a fixed position $(window).scroll(function(){ -
DarrylD created this gist
Nov 5, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ (function(){ var triggerElement = $(".container") //element to he used to trigger the fixed header , header = $(".header") , stickyClass = "stickit" // class to be used to give the fixed header a fixed position $(window).scroll(function(){ var offset = 0,sticky = false,top = $(window).scrollTop(); if (triggerElement.offset().top < top) { header.addClass(stickyClass) sticky = true; } else { header.removeClass(stickyClass).removeAttr('style'); } }); })()