jQuery resize event not firing

前端 未结 7 1533
独厮守ぢ
独厮守ぢ 2021-01-11 09:58

For whatever reason the following:

$(function() {
  $(window).resize(function() {
    alert(\"resized!\");
  });
});

only fires an event wh

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-11 10:56

    I think your alert is causing a problem try this instead

     $(window).resize(function() {
       $('body').prepend('
    ' + $(window).width() + '
    '); });

    jsfiddle

提交回复
热议问题