Usage of anchor points in HTML:
1.Detailed explanation of what html anchor points are
The first step in learning web page knowledge must be HTML, among which html anchors What exactly is the point for?
To put it simply, for example, if you want to read a very long article accurately by segment, you can use anchor points.
2.htmlAnchor point usage example
After understanding what an anchor point is, let’s learn how to use it. .
Instances of using anchor points in js:
1.js method of locating an anchor point
html page can set anchor points, anchor point definition
The first one is to slide on the index bar on the right side of the address book. When you slide to the corresponding letter, it will jump to the anchor point of the corresponding letter.
Idea: Listen to the touchmove event, obtain clientX and clientY, pass them to elementFromPoint, and then execute click() after obtaining the element.
3.Javascript implementation example of navigation anchor scrolling effect
There may be such a requirement in common development pages, the page There will be multiple modules in the module, and each module corresponds to a navigation. When the page scrolls to a certain module, the corresponding module navigation needs to add a class to distinguish the area browsed by the current user.
Anchor related questions and answers:
1.javascript - angular anchor question
2.angular.js - AngularJs controls page output by defining anchor links
3.html5 - Anchor problem of a tag in HTML
The above is the detailed content of Summarize the usage of anchor points in html and js. For more information, please follow other related articles on the PHP Chinese website!