Answer by Nasser Torabzade for Stop browser from auto scrolling when searching document (ctrl + f)

No, you can not disable that.

you only can scroll to nearest slide on every scroll event.

// fill lidesTopOffsets array with top offsets
// of your slides when document is ready
var slidesTopOffsets = [100, 200, 300, 400, 500];

var minDifferecne = 10000;

$( window ).scroll(function() {
    // find nearest slide
    for(var i=0; i < slidesTopOffsets.length; i++){
        if(Math.abs($(window).scrollTop() - slidesTopOffsets[i]) < minDifferecne)
            minDifferecne = slidesTopOffsets[i];
    }

    // scroll to nearest slide
    $(body).animate({
        scrollTop: minDifferecne
    }, 0);
});

hope that it helps.

Leave a Reply

Your email address will not be published. Required fields are marked *