简体   繁体   中英

Box2D is hijacking the window resize listener?

Here is my code:

$(window).resize(function() {

    resize();
    console.log('Resized');

});

This code was working perfectly fine until I implemented Box2D into my project.

Whenever I remove this line...

<script type="text/javascript" src="assets/lib/Box2D.js"></script>

...The resize code works perfectly fine.

Any idea of what's going on? I'm using the Box2DWeb implementation btw.

Alright, so it is still quite a mystery why Box2D is interfering with JQuery's resize function.

My temporary fix is to use the Javascript equivilent:

window.onresize = function(event) {
    resize();
    console.log('Resized');
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM