菜单解决方案中的Jquery-mobile幻灯片

时间:2012-10-25 08:43:42

标签: cordova jquery-mobile

您好我正在尝试使用jquery mobile构建一个phonegap应用程序。  我想在facebook应用程序中创建菜单中的幻灯片。

我搜索了很多,但所有插件或解决方案都很旧,有些甚至不在演示中工作。  有什么建议怎么做?我们的想法是在jquery移动页面的标题左侧应该有一个按钮,当按下它时,它会从左侧滑动菜单,同时将页面推到右侧。

4 个答案:

答案 0 :(得分:12)

你试过这个:

Facebook Style Slide Out Menu

另外,JQM弹出窗口可以像滑出菜单一样使用:

Jquery Mobile Popup SideMenu

这两者都应该满足您的需求。

答案 1 :(得分:9)

我最近需要做同样的事情。以下是我用于简单示例的代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Computer World</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
    <style>
        /*this block should go in the styles.css file*/
        .ui-panel-inner {
            padding:0px; /*make the buttons flush edge to edge*/
        }
        .ui-controlgroup {
            margin:0; /*make the buttons flush to the top*/
        }
        #header {
            height:54px;
        }
        #bars-button {
            margin:7px;
        }
    </style>
</head>
<body>

<div data-role="page" id="home" data-theme="b">

    <div data-role="panel" id="navpanel" data-theme="a"
         data-display="overlay" data-position="right">
        <div data-role="controlgroup" data-corners="false">
            <a href="#" data-role="button">Business</a>
            <a href="#" data-role="button">Numbers</a>
            <a href="#" data-role="button">Money</a>
            <a href="#" data-role="button">People</a>
        </div>
    </div>

    <div id="header" data-role="header" data-theme="b">
        <a id="bars-button" data-icon="bars"  class="ui-btn-right" style="margin-top:10px;" href="#navpanel">Menu</a>
    </div>
</div>
</body>
</html>

有关详细信息,请参阅博文:http://www.objectpartners.com/2013/05/13/adding-a-sliding-menu-to-your-jquery-mobile-app/

这是一个演示:http://jsfiddle.net/nateflink/NWHjB/

答案 2 :(得分:0)

使用jQuery面板...包含在jQuery中。

http://jquerymobile.com/demos/1.3.0-beta.1/docs/panels/index.html

答案 3 :(得分:0)

我认为你所寻求的是快速而简单的方法。如果我是对的你应该使用this jquery mobile demo它解释了定位以及你可能需要的其他一切,如果你想让它完美只需将该演示与this one

结合起来

第二个解释了如何使用滑动来制作侧滑块。

我将它们用于我的phonegap应用程序,希望你也这样做。

相关问题