久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='jk70I'><style id='jk70I'><dir id='jk70I'><q id='jk70I'></q></dir></style></legend>
    <tfoot id='jk70I'></tfoot>

    1. <i id='jk70I'><tr id='jk70I'><dt id='jk70I'><q id='jk70I'><span id='jk70I'><b id='jk70I'><form id='jk70I'><ins id='jk70I'></ins><ul id='jk70I'></ul><sub id='jk70I'></sub></form><legend id='jk70I'></legend><bdo id='jk70I'><pre id='jk70I'><center id='jk70I'></center></pre></bdo></b><th id='jk70I'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jk70I'><tfoot id='jk70I'></tfoot><dl id='jk70I'><fieldset id='jk70I'></fieldset></dl></div>

        • <bdo id='jk70I'></bdo><ul id='jk70I'></ul>
      1. <small id='jk70I'></small><noframes id='jk70I'>

      2. 當 jquerymobile 中的窗口大小更改時更改 div id 和屬

        Change div id and property when window size change in jquerymobile(當 jquerymobile 中的窗口大小更改時更改 div id 和屬性)

          <small id='NPQZf'></small><noframes id='NPQZf'>

          <tfoot id='NPQZf'></tfoot>
        1. <legend id='NPQZf'><style id='NPQZf'><dir id='NPQZf'><q id='NPQZf'></q></dir></style></legend>
          <i id='NPQZf'><tr id='NPQZf'><dt id='NPQZf'><q id='NPQZf'><span id='NPQZf'><b id='NPQZf'><form id='NPQZf'><ins id='NPQZf'></ins><ul id='NPQZf'></ul><sub id='NPQZf'></sub></form><legend id='NPQZf'></legend><bdo id='NPQZf'><pre id='NPQZf'><center id='NPQZf'></center></pre></bdo></b><th id='NPQZf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NPQZf'><tfoot id='NPQZf'></tfoot><dl id='NPQZf'><fieldset id='NPQZf'></fieldset></dl></div>

            <bdo id='NPQZf'></bdo><ul id='NPQZf'></ul>
                <tbody id='NPQZf'></tbody>
                  本文介紹了當 jquerymobile 中的窗口大小更改時更改 div id 和屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我當前的代碼是

                  測試

                  當窗口大小小于640px時,我如何將其更改為:

                  測試

                  data-role="panel" 是 jquerymobile 代碼.問題集中在我們如何將 data-role="panel" 屬性添加到 div 上.謝謝!

                  您可以在 http://jsbin.com/wakagumu/11/edit.如果成功,將 id="column-left" 更改為 data-role="panel" id="left-panel" 后,測試FIRST"將消失.

                  解決方案

                  更改屬性不會將div轉換為面板,您需要初始化 手動.在 jQuery Mobile 1.3 中,您應該在動態附加 panel 時使用 .trigger("pagecreate")初始化它.

                  下面的解決方案創建一個面板并在頁面的寬度較小時移動內容 div的元素;它刪除 panel 并將 content div 的元素返回到它們的原始位置.此外,它會在 header 內創建一個按鈕來打開 面板.它可以用于任何頁面事件以及窗口的throttledresizeorientationchange.

                  $(window).on("throttledresize", function () {var activePage = $.mobile.activePage;if ($(window).width() <500 && activePage.find("[data-role=panel]").length === 0) {/* 創建按鈕 */var button = $("", {"數據角色": "按鈕","數據圖標": "條","id": "panelBtn","數據主題": "e",課程:ui-btn-left"}).text("面板");/* 添加點擊監聽器以打開面板并將其附加到標題 */activePage.find(".ui-header").append($(button).on("click", function () {$("#left-panel").panel("open");}));/* 保存菜單 */var menu = $("#menu");/* 創建一個面板附加菜單創建頁面 */activePage.prepend($("

                  ", {id:左面板",數據角色":面板",數據位置":左",數據顯示":推送"}).append($("

                  ", {課程:ui-panel-inner"}).append(menu))).trigger("pagecreate");}if ($(window).width() > 500 && activePage.find("[data-role=panel]").length === 1) {/* 移除面板和按鈕返回菜單到內容 div */如果(activePage.hasClass(ui-page-panel-open")){activePage.find("[data-role=panel]").panel("close").on("panelclose", function () {var menu1 = activePage.find("[數據角色=面板] #menu");activePage.find("[data-role=content]").append(menu1);activePage.find("[數據角色=面板]").remove();activePage.find("#panelBtn").remove();activePage.trigger("pagecreate");});} 別的 {var menu1 = activePage.find("[數據角色=面板] #menu");activePage.find("[data-role=content]").append(menu1);activePage.find("[數據角色=面板]").remove();activePage.find("#panelBtn").remove();activePage.trigger("pagecreate");}}});

                  <塊引用>

                  演示

                  My current code is

                  <div id="column-left">
                       Test
                  </div>
                  

                  When the window size is smaller than 640px, how can I change it as:

                  <div data-role="panel" id="left-panel" data-position="left">
                       Test
                  </div>
                  

                  data-role="panel" is jquerymobile code. The question is focusing on how we can add the data-role="panel" attribute to the div. Thanks!

                  You may test your code in http://jsbin.com/wakagumu/11/edit. If it success, the test "FIRST" will disappear after changing the id="column-left" to data-role="panel" id="left-panel".

                  解決方案

                  Changing attributes won't convert a div into a panel, you need to initialize it manually. In jQuery Mobile 1.3, you should use .trigger("pagecreate") when appending a panel dynamically in order to initialize it.

                  The below solution creates a panel and moves content div's elements when page's width is small; and it removes panel and returns content div's element to their original position. Also, it creates a button inside header to open the panel. It can be used in any page events as well as on window's throttledresize and orientationchange.

                  $(window).on("throttledresize", function () {
                      var activePage = $.mobile.activePage;
                      if ($(window).width() < 500 && activePage.find("[data-role=panel]").length === 0) {
                         /* create button */
                          var button = $("<a/>", {
                              "data-role": "button",
                                  "data-icon": "bars",
                                  "id": "panelBtn",
                                  "data-theme": "e",
                              class: "ui-btn-left"
                          }).text("Panel");
                          /* add click listener to open panel 
                             and append it to header         */
                          activePage.find(".ui-header").append($(button).on("click", function () {
                              $("#left-panel").panel("open");
                          }));
                  
                          /* save menu */
                          var menu = $("#menu");
                          /* create a panel 
                             append menu
                             create page    */
                          activePage.prepend($("<div/>", {
                              id: "left-panel",
                                  "data-role": "panel",
                                  "data-position": "left",
                                  "data-display": "push"
                          }).append($("<div/>", {
                              class: "ui-panel-inner"
                          }).append(menu))).trigger("pagecreate");
                      }
                  
                      if ($(window).width() > 500 && activePage.find("[data-role=panel]").length === 1) {
                          /* remove panel and button
                             return menu to content div */
                          if (activePage.hasClass("ui-page-panel-open")) {
                              activePage.find("[data-role=panel]").panel("close").on("panelclose", function () {
                                  var menu1 = activePage.find("[data-role=panel] #menu");
                                  activePage.find("[data-role=content]").append(menu1);
                                  activePage.find("[data-role=panel]").remove();
                                  activePage.find("#panelBtn").remove();
                                  activePage.trigger("pagecreate");
                              });
                          } else {
                              var menu1 = activePage.find("[data-role=panel] #menu");
                              activePage.find("[data-role=content]").append(menu1);
                              activePage.find("[data-role=panel]").remove();
                              activePage.find("#panelBtn").remove();
                              activePage.trigger("pagecreate");
                          }
                      }
                  });
                  

                  Demo

                  這篇關于當 jquerymobile 中的窗口大小更改時更改 div id 和屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                    <tfoot id='ARNmO'></tfoot>
                      <tbody id='ARNmO'></tbody>

                      • <small id='ARNmO'></small><noframes id='ARNmO'>

                      • <i id='ARNmO'><tr id='ARNmO'><dt id='ARNmO'><q id='ARNmO'><span id='ARNmO'><b id='ARNmO'><form id='ARNmO'><ins id='ARNmO'></ins><ul id='ARNmO'></ul><sub id='ARNmO'></sub></form><legend id='ARNmO'></legend><bdo id='ARNmO'><pre id='ARNmO'><center id='ARNmO'></center></pre></bdo></b><th id='ARNmO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ARNmO'><tfoot id='ARNmO'></tfoot><dl id='ARNmO'><fieldset id='ARNmO'></fieldset></dl></div>
                        <legend id='ARNmO'><style id='ARNmO'><dir id='ARNmO'><q id='ARNmO'></q></dir></style></legend>

                          • <bdo id='ARNmO'></bdo><ul id='ARNmO'></ul>
                          • 主站蜘蛛池模板: 欧美一级二级视频 | www.久久.com | 国产午夜精品一区二区三区四区 | 黄篇网址 | 国产一区 在线视频 | 亚洲在线视频 | 网站国产 | 国产成人精品一区 | 四虎影视免费观看 | 国产精品久久久久久久久久久久久 | 青青久在线视频 | www.伊人.com| 国产精品一区二区久久久久 | 欧美在线一区二区三区 | 水蜜桃久久夜色精品一区 | 中文字幕免费中文 | 国产精品福利在线观看 | 久久国产精品亚洲 | 亚洲在线一区 | 中文字幕在线观看第一页 | av中文字幕网站 | 欧美成人精品 | 亚洲午夜精品在线观看 | 欧美精品在线一区二区三区 | 黄色av网站在线免费观看 | 国产成人精品区一区二区不卡 | 国产精品一区二区久久久久 | 日韩毛片中文字幕 | 精品九九 | 亚洲人成人一区二区在线观看 | www.99热这里只有精品 | 在线一级片 | 亚洲欧洲精品一区 | 亚洲欧美自拍偷拍视频 | 91网站视频在线观看 | 91精品无人区卡一卡二卡三 | 99九九久久 | 人人澡视频| www.4hu影院 | 欧美久久久久久久 | 成人午夜网站 |