监听浏览器窗口变化,改变宽高大佬们有什么好的建议?

在ready方法中
functioncallbackOpenseadragon(){
console.log('1111111111111111111111111111');
$('#pathologyID').css('height',$('.navigator').height());
$('#pathologyID').css('width',$('.navigator').width());
$('#pathologyID').css('top',$('.navigator').height()+50);
}
functionwindowResizeEvent(callbackOpenseadragon){
varfirstFire=null;
window.onresize=function(){
console.log('aaaa');
if(firstFire===null){
firstFire=setTimeout(function(){
firstFire=null;
callbackOpenseadragon;
},100);
}
}
}
windowResizeEvent();
callbackOpenseadragon方法没有被用到,windowResizeEvent执行了,应该怎么改?
慕斯王
浏览 488回答 2
2回答

红糖糍粑

传参做什么,直接在函数里调用不就好了functionwindowResizeEvent(){varfirstFire=null;window.onresize=function(){console.log('aaaa');if(firstFire===null){firstFire=setTimeout(function(){firstFire=null;callbackOpenseadragon();},100);}}}

小唯快跑啊

varcallbackOpenseadragon=function(){console.log('1111111111111111111111111111');$('#pathologyID').css('height',$('.navigator').height());$('#pathologyID').css('width',$('.navigator').width());$('#pathologyID').css('top',$('.navigator').height()+50);}functionwindowResizeEvent(callbackOpenseadragon){varfirstFire=null;window.onresize=function(){console.log('aaaa');if(firstFire===null){firstFire=setTimeout(function(){firstFire=null;callbackOpenseadragon();},100);}}}windowResizeEvent(callbackOpenseadragon);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript