jquery mobile学习总结

来源:互联网 发布:java treemap 红黑树 编辑:程序博客网 时间:2024/05/17 20:26

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;;}

原创粉丝点击