jQuery Mobile(jqm)按鈕的隱藏和顯示,包括a標籤,圓角和非圓角按鈕

來源:互聯網
上載者:User

標籤:html5   jqm   jquery mobile   隱藏和顯示   事件操作   

在移動互連網時代,HTML5開發越來越收到歡迎。於是各種HTML5的架構都出來了。由於對於jquery的熟悉,jquery mobile 為多數人選擇學習的對象。我也是眾多追求者之一。最近一直在開發jQuery Mobile的相關應用。並頗有心得,再這裡和大家一起分享一下。
好了,我們之間上代碼:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>如有不懂,請加qq群:135430763,共同學習!</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"><script src="http://code.jquery.com/jquery-1.8.3.min.js"></script><script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>  </head>    <body>    <div data-role="page" id="page" data-theme="b"><div data-role="header" data-position="fixed" data-theme="b"><h1>如有不懂,請加qq群:135430763,共同學習!</h1><a href="javascript:location.reload();" data-role="button" class="ui-btn-right" data-icon="refresh">重新整理</a></div><div data-role="content"><p>點擊按鈕2,隱藏按鈕1,並且將按鈕2改為圓角</p><p>點擊按鈕3,顯示按鈕1,並且將按鈕2改為非圓角</p><p>如有不懂,請加qq群:135430763,共同學習!</p><p>如有不懂,請加qq群:135430763,共同學習!</p><p>如有不懂,請加qq群:135430763,共同學習!</p><p>如有不懂,請加qq群:135430763,共同學習!</p><div data-role="controlgroup" data-type="horizontal"><input type="button" value="我是按鈕1" data-inline="true" id="btn1"><input type="button" value="我是按鈕2" data-inline="true" id="btn2"><input type="button" value="我是按鈕3" data-inline="true" id="btn3"></div><p>點擊按鈕5,隱藏按鈕4,並且將按鈕5改為圓角</p><p>點擊按鈕6,顯示按鈕4,並且將按鈕5改為非圓角</p><div data-role="controlgroup" data-type="horizontal"><a href="#" data-role="button" id="a4">我是按鈕4</a><a href="#" data-role="button" id="a5" onclick="hideA();return false;">我是按鈕5</a><a href="#" data-role="button" id="a6" onclick="showA();return false;">我是按鈕6</a></div></div><div data-role="footer" data-position="fixed" data-theme="b"><span style="height: 40px; line-height: 40px; text-align: center; display: block; font-size: 9px;">如有不懂,請加qq群:135430763,共同學習!</span></div></div><script type="text/javascript">//給按鈕2綁定click事件$('#btn2').unbind().bind('click',function(){//隱藏按鈕1$('#btn1').parent("div").css('display','none');//給按鈕2添加樣式,使按鈕2變成圓角$('#btn2').parent("div").addClass('ui-first-child');});    //給按鈕3綁定click事件$('#btn3').unbind().bind('click',function(){//隱藏按鈕1$('#btn1').parent("div").css('display','');//給按鈕2減去ui-first-child樣式$('#btn2').parent("div").removeClass('ui-first-child');});//a5標籤的onclick事件function hideA(){$('#a4').css('display','none');//給a5標籤添加樣式,使a5標籤變成圓角$('#a5').addClass('ui-first-child');}//a6標籤的onclick事件function showA(){$('#a4').css('display','');//給a5標籤刪除樣式,使a5標籤變成非圓角$('#a5').removeClass('ui-first-child');}</script>      </body></html>
在看看運行效果:
更詳細的學習資料,請點擊下載:http://download.csdn.net/download/xmt1139057136/7447463
歡迎大家關注我的個人部落格,如有不懂,請加qq群:135430763進行共同學習!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.