Sehen Sie das Snippet .. hat einige Abschnitte, die die volle Größe des Ansichtsfensters enthalten. Wenn der Benutzer scrollt, sollte er automatisch zum nächsten der Klasse ".section" scrollen.Wie scrollt man automatisch zum nächsten Abschnitt in jQuery?
Englisch ist nicht meine Hauptsprache, sorry für einige Grammatikfehler oder so etwas.
$(document).ready(function(e){
var position = $(window).scrollTop();
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if(scroll > position) {
//scrolling down
} else {
//scrolling up
}
position = scroll;
});
});
html,body { margin:0;padding:0;width: 100%;}
.section {
width: 100%;
height:100vh;
background-color:#000;
}
.section:nth-child(odd) { background-color:#fff;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section id="Home" class="section"></section>
<section id="Home" class="section"></section>
<section id="Home" class="section"></section>
<section id="Home" class="section"></section>
<section id="Home" class="section"></section>
Bitte überprüfen Sie diese Lösung https://stackoverflow.com/questions/21450095/how-to-make-mouse-wheel-scroll-to-section-like-in-mediafire-com http: // jsfiddle .net/N Gj7F/ –