malihu / page-scroll-to-id

Animated page scrolling to specific id within the document with jquery.
MIT License
224 stars 98 forks source link

Can not detect bug of double hight #15

Closed Faha98 closed 7 years ago

Faha98 commented 7 years ago

detect Plugin is great, it is really precise when scrolling to section, however i have met a bug, when intersect 2 sections, there are two highlights in menu, but when call Chrome Dev tools, it simly disappears. image

What can cause that?, and how can i help to solve this bug? JS Code $("a[rel='m_PageScroll2id']").mPageScroll2id({ highlightClass:"link-highlight", }); HTML code `

` And by css adding simple border bottom.

malihu commented 7 years ago

This is not a bug. The highlight feature is completely user-centric, meaning if enough portion of the section is visible on the viewport, its link gets highlighted.

In your case, when dev tools are closed, both sections are considered visible on the viewport (you can see a good portion of both sections), thus both links are highlighted. When dev tools are opened, viewport height gets shorter so only the first section is considered visible (you can only see the title of the second one), so only the first link is highlighted.

If you don't want multiple (e.g. two) links highlighted, see the following faq: http://manos.malihu.gr/page-scroll-to-id/3/#faq-11

Faha98 commented 7 years ago

Thank you very much malihu for such quick respond. Hm, very interesting sollution to make by default multiple highlighting. Next time i should check first all available faq and docs.

malihu commented 7 years ago

You're welcome :)