jQuery resize not working at FireFox, Chrome and Safari

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

or

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


        
8条回答
  •  独厮守ぢ
    2020-12-03 11:56

    Are you trying to set myDiv to a specific size?

    Try the JavaScript code below. I used it for resizing a div which holds a flash object based upon a height being returned from the flash file and it seemed to work okay for me.

    function setMovieHeight(value) {
        var height = Number(value) + 50;
    document.getElementById("video").height = height;
    }
    

    the jQuery equivilent should be:

    function setHeight(value) {
       var height =  number(value) + 50;
       $('#MyDiv').attr('height') = height;
    }
    

    resize does only seem to apply to the windows object.

提交回复
热议问题