Home  >  Article  >  Web Front-end  >  How does jQuery scroll to an element and call the corresponding function_html/css_WEB-ITnose

How does jQuery scroll to an element and call the corresponding function_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:18:241158browse

Just like the title
For example, if my page scrolls to 2e40c084d5946e434ae66558c9fbfb2816b28748ea4df4d9c2150843fecfba68, I will call the call() function. How to achieve this? No need for jQuery plug-ins such as waypoint


Reply to the discussion (solution)

Who knows? You can also enter 9995 characters

for a bit. You can also enter 9994 characters

and calculate the distance of the scroll bar relative to the document and the distance of the div relative to the document. They are equal. method is called when dolphinX/archive/2012/11/19/2777756.html

From: Bitter Man

$(window).scroll(function()	{		var body = document.body && document.body.scrollTop? document.body : document.documentElement;		var height = parseInt(body.scrollHeight) - parseInt(screen.height);		if(body.scrollTop >= height)		{			//开始做你的事情吧。。。		}	});

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn