Created
April 12, 2017 15:30
-
-
Save ejke/f7fc8479ad38d2209d1af859f854f5d9 to your computer and use it in GitHub Desktop.
WP admin bar + sticky header js
This file contains 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
var $document = $(document), | |
$header = $('.admin-bar .site-header'); | |
if($(window).width() < 601) { | |
$document.scroll(function() { | |
if ($document.scrollTop() >= 46) { | |
// user scrolled 46 pixels or more; | |
$header.css({"top": "0"}) | |
} else { | |
$header.css({"top": "46px"}) | |
} | |
}); | |
} else { | |
//nothing | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment