Home  >  Article  >  Web Front-end  >  Briefly introduce the method of jumping within the page using JS

Briefly introduce the method of jumping within the page using JS

巴扎黑
巴扎黑Original
2017-09-04 09:41:441556browse

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);

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


 location.href("#aa");

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!

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