Scroll to the top of an element var about = document.getElementById("about") Alternatively, start with the path of the page.Add the class noZensmooth to the anchor element, for example.If you want only some of the links to be excluded from the automatic smoothing then do one of the following: Exclude a link from the automatic smooth-scrolling In this case Zenscroll will only enable automatic smooth-scrolling in browsers which don’t support this feature yet (e.g., Internet Explorer).ġ.6. In new browsers if the scroll-behavior CSS property is set to smooth on the body (see above).If you set window.noZensmooth to a non-falsy value (see above).The automatic smooth-scrolling is completely disabled in the following cases: smooth-container ) which works in new browsers.ġ.5. If you want to leverage the native smooth-scrolling by the browser (currently available in Firefox 36+ and Chrome 49+) then set the scroll-behavior CSS property to smooth on the body and on the elements you want to scroll. You can also get Zenscroll via npm: npm install zenscrollĮnabling native smooth-scrolling in the browser Important: You can only call Zenscroll when document.body is already available, so don’t try to call Zenscroll functions from the. Zenscroll will also work if you reference it in the but it is not recommended for performance reasons. A good place is at the very bottom, just before the closing tag. Limited support (programmatic animated scroll in document) tested and works under:ĭownload Zenscroll and include it into your page. Can use new browser’s built-in smooth-behavior if it’s enabled.Customize the duration of the individual scroll operations.Specify the spacing between the element and the edge of the screen (e.g., for fixed navigation bars and footers).Scroll to an element and center it on the screen.Scrolling an element into view, making sure both top & bottom are visible, if possible.Scroll to the top of a specific element.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |