Onresize for div elements?

前端 未结 4 719
花落未央
花落未央 2020-11-30 04:36

Visual Studio highlighted my onresize attribute of my div tag, and says that it isn\'t a valid attribute for HTML5. Is this true? What should I use

4条回答
  •  忘掉有多难
    2020-11-30 05:08

    Microsoft's Internet Explorer supports onresize on all HTML elements. In all other Browsers the onresize is only available at the window object. https://developer.mozilla.org/en-US/docs/Web/API/Window.onresize

    If you wanna have onresize at a div in all browsers check this:

    http://marcj.github.io/css-element-queries/

    This library has a class ResizeSensor which can be used for resize detection.

提交回复
热议问题