Home > Web Front-end > HTML Tutorial > 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
Release: 2016-06-24 12:18:24
Original
1191 people have browsed it

Just like the title
For example, if my page scrolls to

, 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)		{			//开始做你的事情吧。。。		}	});
Copy after login

source:php.cn
Previous article:Please tell me what the *> in front of *>.ui-tabs-nav in CSS means?_html/css_WEB-ITnose Next article:Two tags displayed in one line_html/css_WEB-ITnose
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template