You have something that happens there. One, why the class? Do you actually have several of them on the page? CSS tells you you can't. If not, you should use an identifier - choose faster in both CSS and jQuery:
<div id=bottomMenu>You read it all.</div>
Secondly, you have some crazy things in this CSS - in particular, the z-index should just be a number, not a pixel measured. It indicates on which layer this tag is located, where each larger number is closer to the user (or in another way, on top of / occlusal tags with lower z-indices).
The animation you are trying to do is basically .fadeIn (), so just set the div to display: none; natively and use .fadeIn () to animate it:
$('#bottomMenu').fadeIn(2000);
.fadeIn () works by first making the display: (regardless of the correct display property for the tag), opacity: 0, then gradually increasing the opacity.
Full working example:
http://jsfiddle.net/b9chris/sMyfT/
CSS
#bottomMenu { display: none; position: fixed; left: 0; bottom: 0; width: 100%; height: 60px; border-top: 1px solid #000; background: #fff; z-index: 1; }
JS:
var $win = $(window); function checkScroll() { if ($win.scrollTop() > 100) { $win.off('scroll', checkScroll); $('#bottomMenu').fadeIn(2000); } } $win.scroll(checkScroll);
Chris Moschini Apr 03 '13 at 21:37 2013-04-03 21:37
source share