Home > Web Front-end > JS Tutorial > body text

Briefly introduce the method of jumping within the page using JS

巴扎黑
Release: 2017-09-04 09:41:44
Original
1442 people have browsed it

This article mainly introduces the simple code for JS to implement intra-page jump. Friends who need it can refer to

Using js (in $.ajax) To implement intra-page jump (ie: smooth jump of drawing points) method (aa is the id of the jump destination tag):

There is a lot of information on the Internet saying: I tried the animate method but it didn’t work. I don’t know what it is. Please correct me as to why. Attached is the network method:


 var oneTop = $("#aa").offset().top;
 jQuery("html", "body").animate({ scrollTop: oneTop }, 0);
Copy after login

After testing, if you don’t need a sliding animation, you can use the following statement:


 location.href("#aa");
Copy after login

The above is the detailed content of Briefly introduce the method of jumping within the page using JS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!