Jquery Mobile --小知識

1、更改ul後要使用listview('refresh')刷新視圖;
 $('ul').append('<li>row</li>').listview('refresh');
 

2、選取header,並綁定雙擊事件
 $("[data-role='header']").bind('dblclick',function(e){});
 

3、定時變換背景,長按爲taphold
 $('#txt').tap(function(){
 var elem = this;
 $(elem).css('background','yellow');
 setTimeout(function(){$(elem).css('background','transparent');},2000);
 });
 });
 

4、取消Ajax鏈接
 頁面默認爲Ajax鏈接,要把它禁用,有三種方法
 A、<a href="second.html" data-ajax="false">Second</a>
 B、rel="external"
 C、$.mobile.ajaxEnabled=false;
 

5、圖標data-icon類型
 home | delete | plus | arrow-u | arrow-d |  arrow-r | arrow-l|check | gear | grid | star | custom  | minus | refresh | forward | back | alert | info | search
 

6、Button大小
 默認爲屏幕同寬,若要變小使用data-inline="true"
 

7、只有圖標的按鈕
 添加data-iconpos="notext"
 


8、使buttom在header右方
 
class="ui-btn-right"
 

 

9、設置<li class="span">有驚喜,轉個不停。
 

 

10、固定頁面:document.addEvenListener('touchmove',function(e){e.preventDefault();},false);
 

 

11、phoneGap中報錯ERROR whitelist rejection: url
 
在PhoneGap.plist裏,ExternalHosts加個域名,注意不要協議頭,不要路勁和文件名,只要域名(如www.baidu.com)。
 

 

12、取消字段截斷
 
button中
 
.ui-btn-text{
 
white-space:normal;}
 
list中
 
.ui-li-desc{
 
white-space:normal;}
 

 

13、禁用button
 
$('#home-button').button('disable');
 

 

14、去除list中的箭頭
 
<li data-icon="false"><a>row</a></li>
 

 

15、設置頁面背景顏色
 
.ui-page{
 
background:#eee;;}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章