Scroll to next page by mousewheel

I need to change current page to another one by scrolling on mouse.

Imagine, normal function on WordPress for change another post…prev_post and next_post. When you’ll use it in a template, you will get two links. One is previous post and second one next post. When you click on one of them you will be moved to the next or previous page. And I would need to happen the same thing by scrolling mousewheel.

Read More

Can anybody know how to do that?

Related posts

Leave a Reply

2 comments

  1. I would say something like:

    $(window).bind("mousewheel DOMMouseScroll", function(e){
        var delta = parseInt(e.originalEvent.wheelDelta || -e.originalEvent.detail);
        if(delta > 0) {
            window.location.href = nextpage;
        } else {
            window.location.href = previouspage;
        }
    });
    

    Although that can be rather annoying but that is just my opinion.

  2. demo

    var url = document.URL, // full page URL
        pages = [ "index.html", "about.html", "contact.html" ], // LIST OF PAGES
        // retrieve pagename and it it's "" means we're on index.html
        currPage  = url.substring(url.lastIndexOf('/') + 1) || "index.html",    
        wheelAt = $.inArray(currPage, pages), // get 0,1,2,3
    

    You can also use use Brandon Aaron jQuery mouseWheel plugin.

    • you have the Number of the page in array when the browser loads
    • On mousewheel change the value of: wheelAt = mousewheel up||down (-1, +1)
    • than just go to window.location = pages[ wheelAt ]