【ruoyi若依】layer 重置大小/resize
生活随笔
收集整理的這篇文章主要介紹了
【ruoyi若依】layer 重置大小/resize
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
略
layer 重置大小/resize
通過layer.style方法重置大小/resize。
示例
var getDefaultWidth = ()=>{return $(window).width() * 0.95;}; var autoResizeWidth = (index)=>{layer.style(index, {width:getDefaultWidth()+'px'});};var getDefaultHeight = ()=>{return $(window).height() * 0.95;}; var autoResizeHeight = (index)=>{layer.style(index, {height:getDefaultHeight()+'px'});};layer.open({...success: function(layero, index){$(window).resize(function() {if (autoResizeWidth) {autoResizeWidth(index);};if (autoResizeHeight) {autoResizeHeight(index);};});}, });- layer.open成功(success)后,注冊$(window).resize事件,以便窗口大小改變時調整layer的大小。
- var getDefaultWidth = ()=>{return $(window).width() * 0.95;}; 默認寬度是當前窗口寬度的95%。
- var autoResizeWidth = (index)=>{layer.style(index, {width:getDefaultWidth()+'px'});}; 設置layer的寬度為默認寬度。
總結
以上是生活随笔為你收集整理的【ruoyi若依】layer 重置大小/resize的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【ruoyi若依】引入activiti
- 下一篇: 元素类型为 “resultMap” 的内