JQuery $ (window) .resize not shoot in firefox

For environmental reasons, I can only check this now in Firefox, so I don’t know what is happening in other browsers. I am trying to track why the window resizing event binding does not work.

This is an outdated project with a lot of JavaScript, and I can not find anywhere where the events will be unrelated, or any other bindings for resizing.

jQuery version is 1.7.3

I have a code that looks like this:

$(function(){
    $(window).resize(function(){
       console.log("resize 1");
    });
    $(window).on("resize", function(){
       console.log("resize 2");
    });
    window.onresize = function(){
     console.log("resize 3");
    }
});

When I resize the window, only "resize 3" is logged.

If I do this:

$(window).trigger("resize");

Then all three logins to the console.

If I remove window.onresize, nothing happens when I resize, but I run resizing logs.

+3
source share
1

, .resize jquery. , . , .

$(document).ready(function(){
  $(window).resize(function(){
    console.log("this really works for me");
  });
});

http://jsfiddle.net/nTej2/

-1

All Articles