Search code examples
javascriptjqueryjqtouch

trouble initializing jqTouch


I'm trying to add a swipe animation to an element. I've tried initializing jqTouch before the ready handler like this:

var jQT = new $.jQTouch({
    slideSelector:'#navMenu'
});

$(document).ready(function () {
//...
});

But I am getting a TypeError saying that $.jqTouch is undefined. Does anyone know how to solve this?


Solution

  • If you're using jQTouch with jQuery, you now need to include two library files: the jQTouch library, and then the jQTouch jQuery bridge file, which essentially bridges jQTouch to use jQuery instead of the default it ships for, Zepto.js.

    I always find it funny that the library that is named after (or in the style of) a library, now needs a shim in order to work with jQuery :)