在jQuery的移动滑动面板[数据角色=“面板”]
问题描述:
我已经创建滑动面板使用jQuery的移动,我想减少面板的宽度大小,我不知道如何做到这一点?!我用Google搜索了很多,但没有找到正确的一个
我的代码:在jQuery的移动滑动面板[数据角色=“面板”]
<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>
答
用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');
});
但来到像这样... https://docs.google.com/file/d/0B7s0BYiHsMBtUWlGcG1jZWY0cm8/edit?usp=sharing – Sriram 2013-02-27 11:18:31
哪一个你做? – Jai 2013-02-27 11:27:09
css&jquery [top 2] – Sriram 2013-02-27 11:29:54