ブラウザのサイズを変更すると、複数のアラートが表示されます。「return false」を使用しても機能しませんでした。
unbind()/unbind('resize') を使用した場合は機能しますが、別の問題が発生します。resize() 関数は、2 回目のブラウザー/ウィンドウのサイズ変更から機能しなくなります。
私のコード-
<script src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
alert($(".myclass").parent().width());
$(window).bind('resize',function() {
alert($(".myclass").parent().width());
});
});
</script>
<section class="myclass"></section>