• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Floating Top Bar

Forsaken

Well-known member
#2
This is based off of Cezz's work, but was modified for a client a while back so follow his directions, but replace his javascript code with what I provided: http://xenforo.com/community/threads/floating-navigation-bar.19295/

Code:
<script type="text/javascript">
$(function() {
$(window).scroll(function(){
($(window).scrollTop() > 1) ?
$('#moderatorBar').stop().animate({'opacity':'0.7'},400).css({'position':'fixed','top':'0px','z-index':'60', 'width': '100%'}):
$('#moderatorBar').stop().animate({'opacity':'1'},400).css({'position':'absolute','top':'0px', 'width': '100%'});
});
$('#moderatorBar').hover(
function(){ if ($(window).scrollTop() > 0) $(this).stop().animate({'opacity':'1'},400);},
function(){ if ($(window).scrollTop() > 0) $(this).stop().animate({'opacity':'0.7'},400);}
);
});
</script>