jquery mobile中的滑动面板[data-role =“panel”]

时间:2013-02-27 10:50:45

标签: jquery html5 jquery-ui css3 jquery-mobile

我使用jquery mobile创建了滑动面板,我想减小面板的宽度,我不知道怎么做?!我用Google搜索了很多,但没找到正确的一个 我的代码:

<div data-role="page" id="home" class="jqm-demos ui-responsive-panel" data-title="Home">
    <div data-role="panel" id="myPanel" data-theme="a" data-dismissible="true" class="ui-responsive-panel">
        <div id="menu">
            <ul>
                <li class="active"><a href="#home" class="contentLink">Home </a></li>
                <li><a href="#home" class="contentLink">My profile </a></li>
                <li><a href="#home" class="contentLink">My Score </a></li>
                <li><a href="#home" class="contentLink">Ask Questions </a></li>
            </ul>
        </div>
    </div>
    <div data-role="header" data-position="fixed">
        <h1>Home</h1>
        <a href="#myPanel" data-role="button" data-display="reveal" data-position="right" data-icon="gear" data-reveal="reveal" data-dismissible="true">Menu</a>
    </div>

1 个答案:

答案 0 :(得分:0)

尝试使用css:

.ui-responsive-panel{
   width: 200px; /* <---------your choice of px*/
}

使用jQuery:

$(function(){
   $('#myPanel').css('width','200px');
});

或者这个:

   $('#myPanel').width(200);

您的评论: i want decrease the width size of the panel 尝试下面一个:

$(function(){
   $('#myPanel').css('width',$(this).width()-200+'px');
});
相关问题