I have a <ul> with data-role=”listview” attribute. For the <li> elements, i would like to have a <div>, within the <li>, that covers the main contents in the <li>, and when a person swipes to the right, the <div> animates sliding right, revealing the contents underneath div.
My problem is that when I add the div to the <li> element, i cant get the <div> to cover the <li> element. Even if i set a style of style: height=100%, the div seems only to take up about 2/3 of the <li> elements space.
You can add your DIV element to a list-item like so:
HTML —
This creates the following output after jQuery Mobile initializes the list-view:
Then you can add positioning and background-styling to the element:
CSS —
And finally you can detect the swipe events on the “cover” DIVs and animate the element off-screen:
JS —
Here is a demo: http://jsfiddle.net/pmqDf/1/