ウィンドウが一定の幅(1023px)に達したら2 divの内容を入れ替えたいのですが、ウィンドウのサイズを変更するたびにスワップコードを実行し続けることは望ましくありません特定の条件が満たされた後でコードを1回だけ実行する方法はありますか?
$(window).resize(function() {
if($(window).width() <= 1023) {
var $left_col = $('.about-left-col').html();
var $right_col = $('.about-right-col').html();
$('.about-right-col').html($left_col);
$('.about-left-col').html($right_col);
}
});