jquery mobile学习总结

本文介绍了手机应用开发过程中的关键技巧,包括如何利用Ajax链接、实现定时变换背景、禁用按钮、设置背景颜色等,同时提供了在不同场景下如何进行优化的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值