jquery - Fixed floating element-adding animation to addclass -


i want add fadein effect menu when changes classes fixed position @ top when scroll down page.

http://jsfiddle.net/duewg/9/

the js:

$(function () {   var msie6 = $.browser == 'msie' && $.browser.version < 7;   if (!msie6) {     var top = $('#navmenu').offset().top - parsefloat($('#navmenu').css('margin-top').replace(/auto/, 0));     $(window).scroll(function (event) {       var y = $(this).scrolltop();       if (y >= top) {         $('#navmenu').addclass('fiksed');       } else {         $('#navmenu').removeclass('fiksed');       }     });   }   }); 

is effect looking for?

http://jsfiddle.net/duewg/10/

the code:

<script> $(function () {    var msie6 = $.browser == 'msie' && $.browser.version < 7;    if (!msie6) {     var top = $('#navmenu').offset().top - parsefloat($('#navmenu').css('margin-top').replace(/auto/, 0));     $(window).scroll(function (event) {       // y position of scroll       var y = $(this).scrolltop();        // whether that's below form       if (y >= top) {         // if so, ad fixed class         if ( $('#navmenu').is('.fiksed') ) {             return;         }         $('#navmenu').hide().addclass('fiksed').fadein();     } else {         // otherwise remove         $('#navmenu').removeclass('fiksed');       }     });   }   }); </script>  

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -