47 posts
  • Has sold $1+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in United Kingdom
  • Sells items exclusively on Envato Market
+1 more
Renny
says

Im not that much of an expert on jQuery

im using this
$(window).scroll(function (event) {
    var y = $(this).scrollTop();
    if (y > 0) {
        $('.smenu-lower').slideUp('fast');
    } 
    else{
        $('.smenu-lower').slideDown('fast');
    }
});

to get my lower menu to slideUp on scroll down the page, and slideDown again once scrolled back to the top of the page. However i cant figure out how to get it to Slidedown when it isnt at the top when the user hovers over and then slideUp when the user hovers off

http://jsfiddle.net/YhrbW/1/ Uploaded it to here
5465 posts The Dude Abides
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Located in United States
+13 more
CodingJack
says
http://jsfiddle.net/YhrbW/5/

var win = $(window), lower = $('.smenu-lower');

win.scroll(function() {

    slide(win.scrollTop() > 0);

});

$(".smenu").mouseenter(function() {

    slide();

}).mouseleave(function() {

    slide(true);

});

function slide(up) {

    if(up) {
        lower.slideUp('fast');
    }
    else {
        lower.slideDown('fast');
    }

}
47 posts
  • Has sold $1+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in United Kingdom
  • Sells items exclusively on Envato Market
+1 more
Renny
says

Thank you for your help, however this doesnt seem to work? at all? :(

5465 posts The Dude Abides
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Located in United States
+13 more
CodingJack
says

Thank you for your help, however this doesnt seem to work? at all? :(

I first wrote the code, then saw your fiddle and updated it :P

http://jsfiddle.net/YhrbW/5/
5465 posts The Dude Abides
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Located in United States
+13 more
CodingJack
says

Here’s the final version as I assume you want the sticky always showing when scrollTop = 0

http://jsfiddle.net/YhrbW/6/
47 posts
  • Has sold $1+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in United Kingdom
  • Sells items exclusively on Envato Market
+1 more
Renny
says

Here’s the final version as I assume you want the sticky always showing when scrollTop = 0 http://jsfiddle.net/YhrbW/6/

You really are awesome! many many thanks ! :D

Edit: found the solution changed the .smenu target to the #Sticky-Menu instead thanks again!

2nd Edit: Not sure why but it works fine on jsfiddle but in my document it doesnt work at all :S ?

47 posts
  • Has sold $1+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in United Kingdom
  • Sells items exclusively on Envato Market
+1 more
Renny
says


Here’s the final version as I assume you want the sticky always showing when scrollTop = 0 http://jsfiddle.net/YhrbW/6/

You really are awesome! many many thanks ! :D

Edit: found the solution changed the .smenu target to the #Sticky-Menu instead thanks again!

2nd Edit: Not sure why but it works fine on jsfiddle but in my document it doesnt work at all :S ?

cant edit my last post, but now all fixed :)

by
by
by
by
by
by