简体   繁体   中英

How do i get a vertical menu to slide out with my jquery mobile panel?

So i have a menu(only icons) that is on the right side of my screen and I am wanting to get the icons to slide out with my panel when the panel opens. but i want the menu to be visible when the panel is closed. One image will open one panel and another image will open another panel.

<div class="buttons right">
            <a href="#rightpanel3" data-role="button" data-inline="true" class="filter">One</a> 
            <a href="#rightpanel1" data-role="button" data-inline="true" class="layers">Two</a> 
            <a href="#rightpanel2" data-role="button" data-inline="true" class="list">Three</a> 
            <a href="#rightpanel4" data-role="button" data-inline="true" class="settings">four</a>
</div>
<div data-role="panel" id="rightpanel3" data-position="right"
            data-display="overlay" data-dismissible="false" data-theme="b">
            <h3>Search/Filter</h3>
            <h4 class="top heading">Search</h4>
            <h4 class="heading">Filter</h4>
</div>

jsfiddle: jsfiddle.net/5GhPM

May need some tweaking, but this works:

$("#rightpanel3").on("panelopen", function() {
    $(".buttons.right").animate({ marginRight: $("#rightpanel3").width() });
});

$("#rightpanel3").on("panelclose", function() {
    $(".buttons.right").animate({ marginRight: -($("#rightpanel3").width()) });
});

http://jsfiddle.net/yRu4q/

The events are documented here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM