【ruoyi若依】layer 重置大小/resize
生活随笔
收集整理的這篇文章主要介紹了
【ruoyi若依】layer 重置大小/resize
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
前言
略
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事件,以便窗口大小改變時調(diào)整layer的大小。
- var getDefaultWidth = ()=>{return $(window).width() * 0.95;}; 默認(rèn)寬度是當(dāng)前窗口寬度的95%。
- var autoResizeWidth = (index)=>{layer.style(index, {width:getDefaultWidth()+'px'});}; 設(shè)置layer的寬度為默認(rèn)寬度。
總結(jié)
以上是生活随笔為你收集整理的【ruoyi若依】layer 重置大小/resize的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【ruoyi若依】引入activiti
- 下一篇: 琥珀核桃的功效与作用、禁忌和食用方法