43 posts
  • United Kingdom
  • Exclusive Author
  • Sold between 1 and 100 dollars
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
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
5319 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 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');
    }

}
43 posts
  • United Kingdom
  • Exclusive Author
  • Sold between 1 and 100 dollars
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
Renny says

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

5319 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 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/
5319 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 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/
43 posts
  • United Kingdom
  • Exclusive Author
  • Sold between 1 and 100 dollars
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
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 ?

43 posts
  • United Kingdom
  • Exclusive Author
  • Sold between 1 and 100 dollars
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
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