Toggle div up or down based on class of nav that was changed by jquery -


i have nav turns sticky when user scrolls top done adding class jquery. need check class on hover dropdown nav went up, go down.

this sticky nav jquery

$(window).on('scroll', function () {  var scrolltop     = $(window).scrolltop(),     elementoffset = $('#page').offset().top,     fromtop      = (elementoffset - scrolltop);      if ( fromtop <= 30 ) {         // div has reached top         $('.main-navigation').removeclass('main-nav-pos');         $('.main-navigation').addclass('main-nav-fixed');         $('.nav-bottom').css({"display":"none"});     } else {         $('.main-navigation').removeclass('main-nav-fixed');         $('.main-navigation').addclass('main-nav-pos');         $('.nav-bottom').css({"display":"block"});     }  }); 

this nav dropdown:

$('.main-navigation li a').hover(  function() {             //display dropdown             $(this).children('.nav-info').animate({"height":"100%"}, 100);             $(this).children('.nav-info').animate({"top":"-105%"}, 'fast');             $(this).children('.butterfly').css({"display":"block"}, 'slow');         },          function() {             //hide dropdown             $(this).children('.nav-info').animate({"height":"0"}, 100);             $(this).children('.nav-info').animate({"top":"0%"}, 'fast');             $(this).children('.butterfly').css({"display":"none"}, 'slow');         } ); 

everytime try wrap above in if/else, check "main-nav-pos" class, gets real buggy.

thanks in advance help.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -