日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Bootstrap模态框垂直高度居中问题

發布時間:2023/12/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Bootstrap模态框垂直高度居中问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

  Bootstrap對話框改變其默認寬高,高度不會自適應居中。為解決這個問題,最好的方式是能夠通過css來解決,試了幾種網上的方案發現都不行。然后想到可以通過js來修正,什么時候修正最好?于是想到可以注冊全局的事件。

  下表是Bootstrap官方的事件。

Event TypeDescription
show.bs.popoverThis event fires immediately when the?show?instance method is called.
shown.bs.popoverThis event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
hide.bs.popoverThis event is fired immediately when the?hide?instance method has been called.
hidden.bs.popoverThis event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).
inserted.bs.popoverThis event is fired after the?show.bs.popover?event when the popover template has been added to the DOM.
Copy $('#myPopover').on('hidden.bs.popover', function () { // do something… })

  但是,我使用的是$(aa).modal('show'),所以改成這樣:
  
$(function () {//修正modal彈窗高度不能自適應的問題$('body .modal').on('show.bs.modal', function () {var $cur = $(this);$cur.css("top", ($(window).height() - $cur.height()) / 2);}); });

  

?

轉載于:https://www.cnblogs.com/skybreak/p/6774433.html

總結

以上是生活随笔為你收集整理的Bootstrap模态框垂直高度居中问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。