第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

為什么 jQuery Mobile 上的彈出窗口滾動不起作用?

為什么 jQuery Mobile 上的彈出窗口滾動不起作用?

侃侃無極 2022-12-18 15:43:46
我正在使用jquery.mobile-1.4.5。我的情況是滾動不適用于我的應(yīng)用程序。此代碼是我的 index.html,用于從我的 Web 服務(wù)上的 JSON 中獲取數(shù)據(jù)。<div role="main" class="ui-content">  <div data-role="popup" id="popupBasic" data-transition="slideup" style="height: 500px;">    <div data-role="header" style="background: none;">      <h1 class="poppinmedium" style="font-size:14px;">Detail Information</h1>    </div>    <div class="content">      <div class=" img-responsive" id="img-container" style="text-align: center;"></div>      <h4 id="poi-detail-title" class="poppinmedium" style="text-align: center;"></h4>      <!-- <h4 style="text-align: center;" class="poppinthin">Distance:          <span id="poi-detail-distance" class="poppinthin"></span>      </h4> -->      <h4 id="poi-detail-description" class="poppinthin"></h4>    </div>  </div></div>這是我的彈出窗口的 CSS 代碼。.ui-popup-container {  z-index: 1000;  display: inline-block;  position: absolute;  /* background: #fff; */  padding: 0;  outline: 0;  /* overflow: auto; */  max-width: 100% !important;  top: auto !important;  bottom: 0 !important;  left: 0 !important;  width: 100%;}.ui-popup {  border-radius: 20px 20px 0px 0px;  padding-bottom: 8px;  padding-left: 8px;  padding-right: 8px;  padding-top: 10px;}這是打開彈出窗口并滾動它的代碼。但它不起作用:$('#popupBasic').popup('open');$('#popupBasic').on({  popupafteropen: function() {    var maxHeight = 400;    $('#popupBasic').css('max-height', maxHeight + 'px');    $('#popupBasic').css('overflow', 'auto');  }});
查看完整描述

1 回答

?
蝴蝶不菲

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊

為什么你需要那個(gè)z-index?JQM 已經(jīng)在設(shè)置自己的z-index. 例如,彈出屏幕覆蓋(捕獲彈出窗口外的點(diǎn)擊)有z-index1099,彈出容器(用于邊框和默認(rèn)關(guān)閉按鈕)有z-index1100。


如果您需要帶有自動滾動內(nèi)容的彈出窗口,請?jiān)O(shè)置overflow彈出內(nèi)容的 。


演示:


$(function(){

  var longText = ['<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>',

    '<p>Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. </p>',

    '<p>Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. </p>'

    ].join('');


  $('#popupBasic').on({

    popupafteropen: function() {

      var maxHeight = 400;

      $('#popupBasic .ui-content').css({

        'max-height': maxHeight + 'px',

        'overflow': 'auto'});

      setTimeout(function(){ 

        $("#popupBasic .ui-content").html(longText);

      }, 1000);

    },

    popupafterclose: function() {

      $("#popupBasic .ui-content").html("");

    }

  });

});

/* 12 px is the JQM default blur for box-shadows */

.ui-popup-container {

  max-width: 100% !important;

  top: auto !important;

  bottom: 12px !important;

  left: 12px !important;

  right: 12px !important;

}

<!DOCTYPE html>

<html>

  <head>

    <title>Scrollable Popup</title>

    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />

    <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.css" />

    <script src="https://code.jquery.com/jquery-1.11.2.js"></script>

    <script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.js"></script>

  </head>

  <body>

    <div data-role="page">

      <div data-role="header">

        <h1>Scroll Popup</h1>

        <a href="#popupBasic" data-rel="popup" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-gear ui-btn-icon-notext ui-btn-right">Open</a>        

      </div>

      <div role="main" class="ui-content"></div>

      <div id='popupBasic' data-role='popup' data-transition="slideup" data-history="false" style="height: 500px;">

        <div data-role="header" class="ui-bar ui-bar-inherit" style="background: none;">

          <h1 style="font-size:14px;">Detail Information</h1>

          <a href="" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>

        </div>

        <div class="ui-content"></div>

      </div>

    </div>

  </body>

</html>


查看完整回答
反對 回復(fù) 2022-12-18
  • 1 回答
  • 0 關(guān)注
  • 138 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號