我有一个listview,我想做的是在链接上添加一个滑动事件。例如,如果用户刷过第一个链接,它将转到该页面。这是可能与列表视图元素。我试过div,href,a,li,ul但仍然没有警报。它与身体工作。谢谢
<div> <ul data-role="listview" data-inset="true"> <li class="rqstpage"><a href="./requests.PHP">Requests</a></li> <li><a href="./speakers.PHP" data-transition="pop">Control Panel</a></li> <li><a href="./schedule.html">Schedule</a></li> <li><a href="./information.html">Information</a></li> </ul> </div> <script> $("div ul li.rqstpage").bind('swipe',function(event,ui){ $.mobile.changePage("requests.PHP","slide"); }); </script>
解决方法
活动示例:
> http://jsfiddle.net/yxzZf/4/
JS:
$("#listitem").swiperight(function() { $.mobile.changePage("#page1"); });
HTML:
<div data-role="page" id="home"> <div data-role="content"> <p> <ul data-role="listview" data-inset="true" data-theme="c"> <li id="listitem">Swipe Right to view Page 1</li> </ul> </p> </div> </div> <div data-role="page" id="page1"> <div data-role="content"> <ul data-role="listview" data-inset="true" data-theme="c"> <li data-role="list-divider">Navigation</li> <li><a href="#home">Back to the Home Page</a></li> </ul> <p> Yeah!<br />You Swiped Right to view Page 1 </p> </div> </div>
有关: