PhoneGap/Cordova: JQuery animations running slow

前端 未结 2 1004
猫巷女王i
猫巷女王i 2020-12-31 16:34

I have built a an app in PhoneGap/Cordova and used the JQuery library for some simple animations like slideUp etc.

They work fine on the simulator but when I try on

2条回答
  •  温柔的废话
    2020-12-31 16:44

    jQuery animations are done using a setInterval on the css properties being animated and it is not hardware accelerated on mobile devices.

    CSS Transitions are hardware accelerated on most modern devices and are therefore a better choice. There are drop in libraries that can make sure your jQuery animations are done using CSS transitions instead of costly setInterval animations.

    http://playground.benbarnett.net/jquery-animate-enhanced/

    http://ricostacruz.com/jquery.transit/

    Give these a try.

    If you are not using any of the functionality that is missing from Zepto.js, consider using it instead as it is much smaller and lighter than jQuery and made specifically for mobile devices.

提交回复
热议问题