0
我想了解如何將窗口大小事件內的一個值傳遞給函數,但我不知道我在做什麼錯誤。基本上每次窗口調整大小時,我都希望scrollHeight能夠轉到另一個功能,我可以在點擊時查看該值。如何將窗口調整大小的值傳遞給另一個函數
$(window).on('resize', function(){
var mheight = $('#wrapper')[0].scrollHeight;
smoothscroll(mheight);
});
function smoothscroll(mvalue) {
$mheight = this.mvalue;
if ($mheight < 3000) {
$(selector).on('click',function() {
console.log('show me my latest scroll height value for larger screens' + $mheight);
});
} else {
console.log('show me my current scroll height value for smaller screens' + $mheight);
}
}
...但由於某些原因我始終值出現未定義...