zanurano / jquery-ui-for-ipad-and-iphone

Automatically exported from code.google.com/p/jquery-ui-for-ipad-and-iphone
0 stars 0 forks source link

addTouch() not a function #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Include the altfix version of the code
2. Call $('el').addTouch() after including the altfix touch library
3. See error in firebug $('el').addTouch() not a function

What is the expected output? What do you see instead?
addTouch() function to exist

What version of the product are you using? On what operating system?
altfix version of the plugin with jquery 1.6

Please provide any additional information below.
I ran into this issue and solved it by initiating the plugin after jquery has 
loaded. The method used: $(function() {  does not work if the dollar sign has 
been stolen. Use the following instead 

(function ($) {
    //
    // Extend jQuery feature detection
    //
    $.extend($.support, {
        touch: "ontouchend" in document
    });

    //
    // Hook up touch events
    //
    $.fn.addTouch = function() {
        if ($.support.touch) {
            this.each(function(i, el) {
                el.addEventListener("touchstart", iPadTouchHandler, false);
                el.addEventListener("touchmove", iPadTouchHandler, false);
                el.addEventListener("touchend", iPadTouchHandler, false);
                el.addEventListener("touchcancel", iPadTouchHandler, false);
            });
        }

        return this;
    }
})(jQuery);

Original issue reported on code.google.com by jamesmeh...@gmail.com on 7 Jun 2011 at 5:53

GoogleCodeExporter commented 8 years ago
Excellent! Thank you!

Original comment by jc.arand...@gmail.com on 11 Aug 2011 at 10:45

GoogleCodeExporter commented 8 years ago
Cheers works better

Original comment by jackthem...@gmail.com on 22 Jan 2013 at 11:43