How can I improve the page transitions for my Jquery mobile app?

前端 未结 3 594
眼角桃花
眼角桃花 2020-12-25 10:15

I have created a tiny Jquery Mobile app in a single HTML page. The problem I am facing is that the performance of page transitions in Mobile devices is horrendous. After I s

3条回答
  •  醉话见心
    2020-12-25 10:57

    Thank you Gajotres.

    I've replaced "touchstart" with a vclick and added preventDefault(), otherwise I ended up with quite a few pagechangefailed events.

    Back ... // Fastclick on back button - gets rid of the 300ms delay $("#bhome").live('vclick', function(e) { e.preventDefault(); javascript:history.back(1);// $.mobile.changePage("#home", {transition:'fade'}); });

    During development, I think it's a good thing to add the following event handler to ensure that no errors happen :

    $(document).bind("pagechangefailed", function(event, data) {
        $.mobile.loading('hide');
        alert("pagechangefailed"); 
    });
    

提交回复
热议问题