Skip to content

Instantly share code, notes, and snippets.

@KustoSan
Created November 6, 2015 02:54
Show Gist options
  • Save KustoSan/1ca1effa83e5d9814883 to your computer and use it in GitHub Desktop.
Save KustoSan/1ca1effa83e5d9814883 to your computer and use it in GitHub Desktop.
$(window).scroll(function() {
var nav = $(".navbar-collapse");
var position = nav.position();
if (position.top >= 0) {
$('#carousel-402664').css("display", 'inherit')
$('#carousel-402664').css("margin-top", -$(window).scrollTop())
} else if (position.top < 0) {
$('#carousel-402664').css("display", 'none')
$('#carousel-402664').css("margin-top", 0)
}
});
$(window).scroll(function() {
var navSm = $(".navbar-header");
var positionSm = navSm.position();
if (positionSm.top >= 0) {
$('#carousel-402664').css("display", 'inherit')
$('#carousel-402664').css("margin-top", -$(window).scrollTop())
} else if (positionSm.top < 0) {
$('#carousel-402664').css("display", 'none')
$('#carousel-402664').css("margin-top", 0)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment