Reputation: 1415
I have my "html" setted at overflow hidden (no scrollbar), but I have my contentarea div (where all the content is) that is scrollable and has a scrollbar...
What I'm trying to do is if user starts scrolling in the contentarea addClass (jquery) to another div.. if user scroll all the way to the top removeClass...
Here is the code I have that was working fine before I made the "html" overflow hidden..
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() == 0) {
jQuery("#jQ").removeClass("scroll_active");
}
else {
jQuery("#jQ").addClass("scroll_active");
}
});
I tried to put the contentarea id instead of window.. something like this:
jQuery(#contentarea).scroll(function() {
if (jQuery(this).scrollTop() == 0) {
jQuery("#jQ").removeClass("scroll_active");
}
else {
jQuery("#jQ").addClass("scroll_active");
}
});
but it still doesn't work...
Can somebody give me a hand please, I tried everything I can already... Thank you very much
Upvotes: 0
Views: 320
Reputation: 2269
$()
instead of jQuery()
. jQuery()
works but it's unnecessary.$('#contentarea')
or jQuery('#contentarea')
instead of jQuery(#contentarea)
, because you need quotes there. window is an object that exists. #contentarea is a string.ALL MY FIXES TOGETHER: http://jsfiddle.net/mw3H8/1/
Upvotes: 1