Jquery panel + scroll from top detection?

147 views Asked by At

I am currently testing this type of panel jquery : http://codyhouse.co/gem/css-slide-in-panel/

But when i want to detect the scroll from top to make appear a div : no way :(

A means to detect the scroll from top inside a panel? I use this kind of thing without result http://jsfiddle.net/apaul34208/ZyKar/3/

$(document).scroll(function () {
    var y = $(this).scrollTop();
    if (y > 500) {
        $('.cache').fadeIn();
    } else {
        $('.cache').fadeOut();
    }

});

Best regards,

1

There are 1 answers

0
glend On

Is this what you are looking for?

http://jsfiddle.net/ZyKar/2327/

HTML

<div class="topMenu"></div>

CSS

body {
    height:1600px;
}
.topMenu {
    display: none;
    position: fixed;
    top: 0;
    width: 100%;
    height: 60px;
    border-bottom: 1px solid #000;
    background: red;
    z-index: 1;
}

Javascript

$(document).scroll(function () {
    var y = $(this).scrollTop();
    if (y > 1) {
        $('.topMenu').fadeIn();
    } else {
        $('.topMenu').fadeOut();
    }

});