开发者

jQuery Mobile and Normal jQuery

I am playing around with jQuery Mobile as I am hoping to be able to develop digital publications strictly for the iPad.

I have no problem understanding the basics of this as I am quite 'in the know' with jQuery as it stands. My problem is - can you still use normal jQuery functions and events when in the mobile wrapper?

I am running this code to initiate a tap event on a fixed position div to show another absolutely positioned div which is off page (a contents selector)

($)(function(){

    $('.indexPage').live('swipeleft swiperight', function(event){

        if(event.type == 'swipeleft') {
            $.mobile.changePage( "index2.html", {type: 'get'});
        }

        if(event.type == 'swiperight开发者_运维知识库') {
            $.mobile.changePage( "index.html", {type: 'get',reverse: true}  );
        }

    });

    $('#sticky').live('tap', function(event){

        console.log('#sticky tapped');

        $('#contents').show();
    });

});

Can anyone shed any light on the matter?


As far as I know, I'd say yes you can. For example all my bindings of the change events still works perfectly.

However I'd say that it's better to avoid mouse events and to use the virtual mouse events provided by jQuery mobile instead. And all the plugin you might want to use probably won't work (for example, some part of jQuery-UI are not working).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜