jQuery resize not working at FireFox, Chrome and Safari

后端 未结 8 1289
刺人心
刺人心 2020-12-03 11:30
$(\"#dvMyDIV\").bind(\"resize\", function(){
    alert(\"Resized\");
});

or

$(\"#dvMyDIV\").resize(function(){
    alert(\"Resized\         


        
8条回答
  •  春和景丽
    2020-12-03 12:02

    With MSIE everything works just fine. With Firefox, I guess you'll have to resort to some oblique techniques such as storing the element's original width/height in custom properties and using $(elem).bind('DOMAttrModified', func). Then in the func() callback, check if the new width/height differ from the ones you stored previously, take the respective resize action and store them again for the next event callback. Note that this approach works for Firefox only. I haven't been able to find a decent workaround for Chrome, Safari and Opera yet. Maybe using window.setInterval() would do but... sounds too slopy... event the thought of it makes me kinda sick :(

提交回复
热议问题