i want a simple JS code to detect Scrolling of HTML page.
Check this page : http://conf.iranwebfestival.com/
As you scroll the page, the top menu elements, get CSS borders .
I need somthing to do that .
i want a simple JS code to detect Scrolling of HTML page.
Check this page : http://conf.iranwebfestival.com/
As you scroll the page, the top menu elements, get CSS borders .
I need somthing to do that .
That page doen't render properly on my device..
But to detect scrolling with jQuery, I'd check the value of $(window).scrollTop()
, and if it was bigger than 0, it would mean the user had scrolled. Something like this:
$(window).scroll(function() // when user scrolls
{
if($(window).scrollTop() > 0)
// scrollbar is not at the top
else
// scrollbar is at the top
}
Although it's very much your responsibility to prove you have at least tried, googled it, whatever, and you have not done this, this answer is simple enough in jQuery
$(window).scroll(function(){
//Whatever you want to do
});
You could use jQuery Waypoints. Or if you're using Bootstrap look into Scrollspy.
You should put some effort into implementing it. A simple search would have got you what you wanted.
jQuery has a function scrollTop
to find how much screen was scrolled down. Here is base of using
$(window).scroll(function(){
var ScrolledDown = $(window).scrollTop();
});
and here is a example how to use jQuery's function scrollTop - and avoid scrolling if you achieved bottom of page.
Switch div from fixed to absolute at bottom of browser (see my answer)