Search code examples
jqueryhtmljquery-pluginsscrolltoside-scroller

ScrollTo conflict with Mousewheel.js, need more specific events?


I'm building a side scrolling website. I'm using Mousewheel.js from CSS-Tricks to enable sidescrolling and scrollTo from Ariel Flesler to jump to specific points in the site (which I haven't really mastered yet but I think that's besides the point). When I try to utilize them together I get this in the console:

Uncaught TypeError: Object #<Object> has no method 'mousewheel' 

Mousewheel utilizes this script:

$(function(){
    $("#container").wrapInner("<table cellspacing='30'><tr>");
    $(".post").wrap("<td></td>");
    $("body").mousewheel(function(event, delta) {
        this.scrollLeft -= (delta * 30);
        event.preventDefault();
    });   
});

I suspect that the event is not specific enough but I'm not sure how to fix that. In case it wasn't already obvious from my question, I'm a jQuery noob.

Any help would be much appreciated.


Solution

  • I had not included a copy of scrollTo that was visible to the html page.