Home > Article > Web Front-end > Briefly introduce the method of jumping within the page using JS
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!