Created
March 11, 2015 10:26
-
-
Save amekusa/98da7a1bdb58362631cc to your computer and use it in GitHub Desktop.
Sticky Header
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 characters
| /** | |
| * Sticky Header | |
| * @author amekusa <[email protected]> | |
| */ | |
| jQuery(document).ready(function ($) { | |
| var $header = $("#header"); | |
| $header.css("position", "relative"); | |
| $(window).on("scroll", function () { | |
| $header.css("top", $(this).scrollTop()); | |
| }); | |
| }) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This method does’nt use
postition: fixed.So the header can be scrolled out horizontally.