I am making an app with PhoneGap 1.3.0 and Jquery Mobile 1.0. To scroll a listview I want to use iScroll but scrolling performence is too bad. Scrolling is too slow.
Also I made some test.
If I use the code without jQuery Mobile it is fast
<div id="scroller">
    <ul id="thelist" >
        <li>Pretty row 1</li>
        <li>Pretty row 2</li>
        <li>Pretty row 3</li>
...
But if I add jQuery Mobile type listview like.
<div id="scroller">
    <ul id="thelist" data-role="listview" data-inset="true" data-theme="c">
        <li>Pretty row 1</li>
        <li>Pretty row 2</li>
        <li>Pretty row 3</li>
It is slow. How can I fix it?
 
                        
You can remove the
-downand-hoverCSS styles from the style-sheet for jQuery Mobile. When you scroll a list you are "hovering" your finger over a list-item which triggers it to change it's styling due to the-hoverclass that is applied. If you change the-hoverclass to be the same as the-upclass then no redraws will occur and scrolling will be much smoother. I have tested this and it worked great on my Android 2.3 device.Here is an example of what I mean, notice the
-up/-down/-hoverversions of the class rules:UPDATE
So to make the changes I've suggested it's as simple as downloading the jQuery Mobile framework, opening the non-minified version of the CSS style-sheet (also found here: http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.css), and deleting the
-downand-hoverclasses.You can download jQuery Mobile here: http://jquerymobile.com/download/
Basically, look for all of the
.ui-btn-***-*class declarations and delete the code inside the ones where***equalshoverordown, and there will be multiples because there is one for each theme, that's what the last*is for,a-e.The above CSS would look like this when you're done:
Notice I did nothing to the
.ui-btn-up-aclass, it is the default class and I don't want to change the look of the page, I just want to stop the browser from redrawing the document when scrolling a list.When you are all done editing the CSS style-sheet, copy the code and paste it into http://htmlcompressor.com/compressor.html, choose the "CSS" option on the right, and click "Compress." That will create a minified version of your CSS style-sheet that is ready for the production environment (this will greatly reduce the size of the code).