鼠标滚轮改变BootStrap的弹出框大小
加了滚动监听事件,每次改变弹出框大小
var scrollFunc=function(e){ e=e || window.event; var ss=document.getElementById("test"); if(ss.style.height==""){//改高度 ss.style.height=400+Number(e.wheelDelta)/10+"px"; }else{ ss.style.height=Number(ss.style.height.substr(0,ss.style.height.indexOf('px')))+Number(e.wheelDelta)/10+"px"; } if(ss.style.width==""){//改宽度 ss.style.width=900+Number(e.wheelDelta)/10+"px";//初始值 }else{ ss.style.width=Number(ss.style.width.substr(0,ss.style.width.indexOf('px')))+Number(e.wheelDelta)/10+"px"; } } /*注册事件*/ if(document.addEventListener){ document.addEventListener('DOMMouseScroll',scrollFunc,false); }//W3C window.onmousewheel=document.onmousewheel=scrollFunc;//IE/Opera/Chrome
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/16879.html