欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jqueryMobile 動態(tài)添加元素,展示刷新視圖的實現(xiàn)方法

 更新時間:2016年05月28日 11:11:06   投稿:jingxian  
下面小編就為大家?guī)硪黄猨queryMobile 動態(tài)添加元素,展示刷新視圖的實現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

jQuery Mobile的是一個很好的移動開發(fā)框架,你可能已經(jīng)知道,雖然它有很多難以解決的問題,但是我相信后續(xù)版本jquery會修復(fù)……我是很喜歡jquery的。這并不是說它很完美無暇,很多開發(fā)人員遇到的情況也都難解決,比如:嘗試使用代碼來添加,更新或刪除元素,使用JavaScript的頁面跳轉(zhuǎn)。在這篇博客文章中,我列出了一些動態(tài)添加組建重新刷新的方法。

1.Textarea field

$('body').prepend('<textarea id="myTextArea"></textarea>');
$('#myTextArea').textinput(); 

2.Text input field

$('body').prepend('<input type="text" id="myTextField" />');
$('#myTextField').textinput(); 

3.button

$('body').prepend('<input type="text" id="myTextField" />');
$('#myTextField').textinput(); 

3.Combobox or select dropdowns

<label for="sCountry">Country:</label>
<select name="sCountry" id="sCountry">
  <option value="">Where You Live:</option>
  <option value="ad">Andorra</option>
  <option value="ae">United Arab Emirates</option>
</select>
 
var myselect = $("#sCountry");
myselect[0].selectedIndex = 3;
myselect.selectmenu('refresh'); 

4.最常見的動態(tài)添加 listview>li 標(biāo)簽

<ul id="myList" data-role="listview" data-inset="true">
  <li>A</li>
  <li>B</li>
  <li>C</li>
</ul>
 
$('#mylist').listview('refresh'); 

5.Slider control

<div data-role="fieldcontain">
  <label for="slider-2">Input slider:</label>
  <input type="range" id="slider-2" value="25" min="0" max="100" />
</div>
 
$('#slider-2').val(80).slider('refresh'); 

6.Toggle switch

<span><div data-role="fieldcontain">
  <label for="toggle">Flip switch:</label>
  <select name="toggle" id="toggle" data-role="slider">
    <option value="off">Off</option>
    <option value="on">On</option>
  </select> 
</div>
 
var myswitch = $("#toggle");
myswitch[0].selectedIndex = 1;
myswitch .slider("refresh");</span> 

7.Radio

<span><div data-role="fieldcontain">
  <fieldset data-role="controlgroup" data-type="horizontal">
    <legend>Layout view:</legend>
      <input type="radio" name="radio-view" value="list" />
      <label for="radio-view-a">List</label>
      <input type="radio" name="radio-view" value="grid" />
      <label for="radio-view-b">Grid</label>
      <input type="radio" name="radio-view" value="gallery" />
      <label for="radio-view-c">Gallery</label>
  </fieldset>
</div>
 
$("input[value=grid]").attr('checked',true).checkboxradio('refresh');</span> 

8.Checkboxes

<div data-role="fieldcontain">
  <fieldset data-role="controlgroup">
    <legend>Agree to the terms:</legend>
    <input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" />
    <label for="checkbox-1">I agree</label>
  </fieldset>
</div>
 
$('#checkbox-1').attr('checked',true).checkboxradio('refresh'); 

還有很多還需要慢慢發(fā)現(xiàn)!我做的是一個移動點餐系統(tǒng):目前產(chǎn)品界面顯示如下圖:不知道有沒有誰自己封裝的listview,或者號的插件推薦我使用的!或有更好的建議……歡迎發(fā)表。

以上這篇jqueryMobile 動態(tài)添加元素,展示刷新視圖的實現(xiàn)方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論