• Hi,

    I like your plugin feature. I want to know will it be possible to show mousewheel scroll effect on my page first two section and remain section normal scroll.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author malihu

    (@malihu)

    Hello,

    In general, mousewheel functionality is out of plugin’s scope. There’s an extra script that enables page scrolling via mousewheel (when the plugin is activated) but it works for the full document (i.e. not for specific page sections).

    So you can’t really do what you ask, at least not without developing some custom js script specific to your page layout and theme.

    Thread Starter mktunicus

    (@mktunicus)

    Hi,

    For mousewheel functionality i added below code on my footer.php

    <script>
    (function($){
    $(window).load(function(){
    /* mousewheel/keyboard section scrolling */
    $(document)
    //custom event
    .on(“scrollSection”,function(e,dlt){
    //sel variable is elements selector
    //change to a more specific selector if needed (e.g. “.menu-item ._mPS2id-h”)
    var sel=$(“._mPS2id-h”);
    if(!$(“html,body”).is(“:animated”)){ //scroll one section at a time
    //set current element index (change to a more specific selector if needed)
    var i=sel.index($(“.mPS2id-highlight-first”));
    //check first and last elements to prevent scrolling and scroll to next/previous sections
    if(!(i===0 && dlt>0) && !(i===sel.length-1 && dlt<0)) sel.eq(i-dlt).trigger(“click”);
    }
    })
    //mousewheel event
    .on(“mousewheel DOMMouseScroll”,function(e){
    e.preventDefault();
    //send normalized mousewheel delta (-1/1) to scrollSection
    $(this).trigger(“scrollSection”,((e.originalEvent.detail<0 || e.originalEvent.wheelDelta>0) ? 1 : -1));
    })
    //keyboard arrows event
    .on(“keydown”,function(e){
    var code=e.keyCode ? e.keyCode : e.which;
    if(code===38 || code===40){ //up, down
    e.preventDefault();
    $(this).trigger(“scrollSection”,(code===38 ? 1 : -1));
    }
    });
    });
    })(jQuery);
    </script>

    But mousewheel scroll effect not came. Below is the url:
    https://demo.nyc-it.com/testing

    Plugin Author malihu

    (@malihu)

    The plugin is not currently enabled on your menu links. Your theme (or another plugin) handles the menu links and scrolls the page.

    You need to enable “Page scroll to id” to handle the menu links in order for the extra script to work. You can do this by adding the ps2id class in your menu items or by changing the “Selector(s)” option in plugin settings to:
    a[href*=#]:not([href=#])

    After doing this, the mousewheel script should work.

    Please note that using the mousewheel to scroll through sections is best used with specific page layouts (e.g. sections that don’t expand vertically below the viewport).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Mousewheel scroll effect only to first two section’ is closed to new replies.