2011-11-25 31 views
3

這就是我現在所擁有的格式在ListView一個選擇:http://jsfiddle.net/w6PAC/3/如何使用jQuery Mobile的

我想選擇按鈕以計數的權利,又不影響列表的垂直尺寸和對齊項目。

我曾嘗試:

  1. 創建基礎上,.ul-li-count類CSS,但只設法打破JQM增強。
  2. 在listview外單獨創建按鈕,但我無法垂直對齊它們。
  3. 玩場地集,數據角色,divs等沒有成功。

AFAIK無法以編程方式調用選擇,否則我會向列表視圖中添加一個普通按鈕。

任何幫助非常感謝,包括對替代文檔佈局的建議。

回答

1

如果我理解正確,那麼你可以使用一些非常簡單的CSS改變的jQuery Mobile的默認佈局:

/*absolutely position the <select> to the right side of the <li> and center it within the <li>*/ 
.custom_list .ui-select { 
    position : absolute; 
    right  : 10px; 
    top  : 50%; 
    margin-top : -1.4em; 
} 
/*add some extra padding to the right side of the <li> to make the text wrap properly*/ 
.custom_list .ui-li { 
    padding-right : 80px; 
} 
/*change the position of the <span class="ui-li-count"> to make room for the <select>*/ 
.custom_list .ui-li-count { 
    right : 50px; 
} 

請注意,我用的是.custom_list類爲目標的所需<ul>元素,以便爲實現此解決辦法正確地,您必須從上面的CSS聲明中刪除.custom_list,或將.custom_list類添加到您要自定義的<ul>元素。

這裏是上述解決方案的jsfiddle:http://jsfiddle.net/jasper/w6PAC/4/

+0

輝煌,謝謝! – hplbsh