最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

詳解處理bootstrap4不支持遠(yuǎn)程靜態(tài)框問題

 更新時間:2018年07月20日 09:44:00   作者:棲遲於一丘  
這篇文章主要介紹了詳解處理bootstrap4不支持遠(yuǎn)程靜態(tài)框問題,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

起步

我就是喜歡用新的,況且 bs4 出來也很久了,用了一段時間后發(fā)現(xiàn)它并不支持遠(yuǎn)程靜態(tài)框了,查了一下這部分已經(jīng)被移除了。

 

所以,以前的 <a data-toggle="modal" href="remote.html" rel="external nofollow" data-target="#modal">Click me</a> 這種寫法就沒法用了,因此這部分要手動處理下。

處理

處理的方式其實也比較簡單,改成手動 load 而已,按照 bs3 的效果是遠(yuǎn)程結(jié)果取代靜態(tài)框中的 modal-content 部分:

<button data-toggle="modal" data-remote="remote.html" data-target="#modal">Click me</button>

<script>
 $('#modal_result').on('hidden.bs.modal', function (e) {
   $(this).find('.modal-body').html(' 等待結(jié)果,請稍后...');
   $(this).removeData('bs.modal');
 }).on('show.bs.modal', function (e) {
   // 手動處理下載入過程
   var button = $(e.relatedTarget);
   var modal = $(this);

   modal.find('.modal-content').load(button.data("remote"));
 });
</script>

完整demo

<!DOCTYPE html>
<html >
<head>
 <meta charset="utf-8">
 <title>Codeply preview</title>
 <link  rel="external nofollow" rel="stylesheet">
</head>
<body >
  <button data-toggle="modal" class="btn btn-primary" data-remote="a.html" data-target="#modal">Click me</button>

<div id="modal" class="modal fade">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
              aria-hidden="true">×</span></button>
          <h4 class="modal-title"></h4>
        </div>
        <div class="modal-body">
          等待結(jié)果,請稍后...
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">關(guān)閉</button>
        </div>
      </div>
    </div>
  </div>

 <!--scripts loaded here-->

<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>

<script>
 $('#modal').on('hidden.bs.modal', function (e) {
   $(this).find('.modal-body').html(' 等待結(jié)果,請稍后...');
   $(this).removeData('bs.modal');
 }).on('show.bs.modal', function (e) {

   var button = $(e.relatedTarget);
   var modal = $(this);

   modal.find('.modal-content').load(button.data("remote"));
 });
</script>

</body>
</html>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

陆良县| 澎湖县| 彩票| 红桥区| 新龙县| 泰顺县| 大石桥市| 天气| 怀宁县| 井研县| 鄂托克前旗| 道孚县| 天津市| 新丰县| 渭南市| 读书| 普兰店市| 政和县| 义乌市| 综艺| 郧西县| 清流县| 四子王旗| 乐至县| 扶绥县| 浮山县| 白水县| 兴宁市| 杭锦后旗| 屯门区| 封开县| 北宁市| 体育| 梁河县| 湖南省| 邯郸市| 民丰县| 宁阳县| 昌吉市| 仪征市| 桂林市|