JQM开发Tips

1、radio Button 点击后有时候有高亮样式,有时候没有

解决方案:

1         $("#task_form label").click(function () {

2             $("#task_form label").removeClass("ui-btn-active");

3             $(this).addClass("ui-btn-active");

4         });
View Code

2、引入jQ datepicker控件后,弹出框弹出多次,'tap'-轻击事件多次绑定,导致时间成跳跃式增长的bug。

解决方案:

打开datepick.js,将年,月,日增减6个按钮的tap事件的绑定前面分别加上unbind("tap")

3、toggle switch默认是off的状态,如果要默认是on的状态,则在on状态的option加上"selected"属性。

 1   <div data-role="fieldcontain">

 2             <select name="toggleswitch1" id="toggleswitch1" data-theme="" data-role="slider">

 3                 <option value="0">

 4                     不记住

 5                 </option>

 6                 <option value="1" selected>

 7                     记住

 8                 </option>

 9             </select>

10         </div>
View Code

4、将Header,Footer设置为position:fixed的页面点击空白处的时候fixed的效果失效。

解决方案:在header,footer元素上都加上 data-tap-toggle="false",在页面初始化时候加入以下代码:

1 $(document).bind("mobileinit", function () {

2      $.mobile.touchOverflowEnabled = true;

3 });
View Code

 5、$.mobile.changePage()的方法有个bug,在changePage到相应页面后,会迅速跳回到第一个页面,如果在form中设置action及method属性,那么提交表单后即会跳转到action对应的page。

你可能感兴趣的:(tips)