2

I have created an panel in my app and used data-display="reveal" so as we press on the bar icon it will slide the main page and will display the panel.Know what i want to do is when i slide my main page it should display the panel. And one more thing i want both of the function to used means when i slide the window it should open the panel and if i press on the bar icon it should open the panel can any one tell how to do this. here is the code that use to create a panel:

<a href="#menu" data-role="button" data-icon="bars" data-iconpos="notext" data-inline="true">Menu</a>
<div data-role="panel" id="menu" data-position="right" data-position-fixed="true" data-display="reveal" >
         <ul data-role="listview" data-inset="false"  data-theme="d" data-divider-theme="d"  data-icon="false">
        <li><a href="#">Home</a></li>
        <li><a href="#">Guides</a></li>
        <li><a href="#">Demos</a></li>
        <li><a href="#">Q&A</a></li>
         </ul>
    </div>

Thanks in advance

4

1 回答 1

0

对不起,我要给你一个工作的例子

$(function() {
    $('body').on('swipeleft', function () {
        $('#menu').panel('open', '');
    });

    $('body').on('swiperight', function () {
        $('#menu').panel('close');
    });
});

jsFiddle 演示

于 2013-07-24T03:07:13.067 回答