[] from beginners positioning navigation problem About Baidu encyclopedia.

The Baidu encyclopedia website link: http://baike.baidu.com/link?url=G6vU1DurqsIszIGjfyDvNu9Vu0mGtPHkSLU8jjQpIVVFIhceZfLmHl9Rb0X5mmQZr8LCnWJ6Xrybc_dhz69o8XkqMHyl58Dp48LNz9iyISpfzhM09O-UcLOwue-7Lo10#6
Navigation and positioning. The Coffee right about the:
The problem: what is the positioning and navigation of the source code? How to write? Difficult place to have a definition is better. The first questions here, trouble you. The article mainly is placed in a Webpage, can point to their small Title automatically go to the designated place

Started by Eli at December 12, 2016 - 10:28 PM

Posted by Eli at December 21, 2016 - 10:36 PM

Posted by Eli at December 28, 2016 - 11:30 PM

I'm going to talk about ideas, do not know whether you will click into place.

The first analysis of the event, JS is an event driven, right navigation cursor is obviously changed in an event triggered by. Well, think of interaction, is obviously the scroll event. document.onscroll.

Then analysis of scroll event, JS needs to do what? Right navigation cursor is how to change? Apparently the cursor position and the current document position, yes, that is document.scrollTop. The value of scrollTop change with rolling, we only need to judge the value, need to know where the cursor.

Further, in order to conveniently according to document scrollTop value judgment of directory navigation in the cursor position, we need to create a table, the scrollTop corresponding to the pre recorded under the title and. We know, in the catalogue of each corresponding left in a block, so the page rendering is completed, the content from the document at the top of the range has been determined. The distance in combination with the scrollTop of the current document value, you can know the current user is viewing what part, then the cursor positioning on the right to the position indication on the right.

Posted by Amanda at January 02, 2017 - 12:20 AM