javascript - Js on scroll event scroll to next/previous div -
I am trying to create a website scrolling tool when a visitor wants to scroll, Should go to the previous device.
Below you can see what my HTML looks like.
& lt; Body & gt; & Lt; Header & gt; & Lt; / Header & gt; & Lt; Div id = "content" & gt; & Lt; Div id = "contentv1" & gt; & Lt; / Div & gt; & Lt; Div id = "contentv2" & gt; & Lt; / Div & gt; & Lt; Div id = "contentv2" & gt; & Lt; / Div & gt; & Lt; Div id = "contentv2" & gt; & Lt; / Div & gt; & Lt; Div id = "contentv3" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; I'm trying with the following code:
(function () {var scrollTo = function (element) {$ ('html, body ') ()) () () () () () () () $ ($) ($) $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ($ Current.index ()! = $ ('# Content & gt; div' ) Length - 1) {$ current.removeClass ('Current'). Next (). AddClass ('On'); ScrollTown ($ Current.ext ());}}); $ ('Body') MouseHeal (function) {event.preventDefault (); var $ current = $ ('# content & gt; ON'); if (! $ Current.index () == 0) $$ current.removeClass ('current '). Previous (). AddClass (' current '); scrollTo ($ current.prev ());}});}) (); The headline sticks up to 10% and the height of the content divs is 90%, so when the top is scrolled, then the bottom of the header on the content divisions Must come.
Can anyone help me in the right direction?
Comments
Post a Comment