簡體   English   中英

增加和減少jQuery移動面板的寬度

[英]Increase and decrease the width of jquery mobile panel

我正在使用jquery移動面板。 我在面板中添加內容。

$("#load").on("click", function () {
    var items = $("#p2 .ui-content").contents().clone();
    $(this).after(items);
});

例:

http://jsfiddle.net/Palestinian/Lcbd2/

我想減小面板的寬度,但是當第二次在面板中添加內容時再次獲得實際尺寸。

面板的原始尺寸為width: 17em;

使用CSS使面板更小。

.ui-panel {
width: 12em !important;
}

如果要向左或向右定位特定的面板

.ui-panel-position-right {
width: 12em !important;
}

.ui-panel-position-left{
width: 12em !important;
}

演示

http://jsfiddle.net/ybvfxu39/

jQuery的 現在您知道面板的原始大小為17em ,可以在需要時使用以下代碼設置大小。

$(".ui-panel-position-right").css("width", "12em");

演示

http://jsfiddle.net/z4k8L3vu/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM