ウィンドウの幅が変わるたびに、イベントが発生するから、
処理をためない為に、すべてを処理をせず、200ミリ秒毎に処理。
var timer = false;
$(window).resize(function() {
if (timer !== false) {
clearTimeout(timer);
}
timer = setTimeout(function() {
console.log(‘resized’);
// 処理
}, 200);
});
Representation design of material
ウィンドウの幅が変わるたびに、イベントが発生するから、
処理をためない為に、すべてを処理をせず、200ミリ秒毎に処理。
var timer = false;
$(window).resize(function() {
if (timer !== false) {
clearTimeout(timer);
}
timer = setTimeout(function() {
console.log(‘resized’);
// 処理
}, 200);
});