11

こんにちは、jquery mobile を使用して phonegap アプリケーションを構築しようとしています。Facebookアプリケーションのようにメニューにスライドを作成したいと思います。

私はたくさん検索しましたが、すべてのプラグインまたはソリューションは古く、一部はデモで動作しません. これを行う方法はありますか?アイデアは、jqueryモバイルページのヘッダーの左側にボタンが必要であるということです。ボタンを押すと、左側からメニューにスライドし、同時にページを右側に押します。

4

4 に答える 4

12

これを試しましたか:

Facebook スタイルのスライド アウト メニュー

また、JQM ポップアップはスライド アウト メニューのように使用できます。

Jquery モバイル ポップアップ サイドメニュー

どちらも、必要なことをほとんど行う必要があります。

于 2012-10-25T08:50:13.083 に答える
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/

于 2013-05-13T14:45:23.167 に答える
0

jQuery パネルを使用します... jQuery に含まれています。

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

于 2013-10-24T15:05:42.310 に答える