开发者

How to automatically execute a Javascript function whenever width or height of a div changes?

How to automatically execute a Javascript function w开发者_如何学Pythonhenever width or height of a div changes? I don't want to trigger an event manually. I am using jQuery.


Try this plugin:

  • http://benalman.com/projects/jquery-resize-plugin/

From their example:

$("#unicorns").resize(function(e){
  // do something when #unicorns element resizes
});


Unfortunately there is no built in support for this. the .resize() function is only for the window object, and the .change() function is only for input elements. You will need to do it manually to the best of my knowledge.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜