Sometimes you may want to have a certain event take place if a visitor to
your website resizes his or her browser window. With HTML 5, you can use the
onresize Event Attribute
. You can apply the event attribute to
the body tag, e.g.:
<body onresize="someFunction()">
The event that would occur when the browser window is resized will depend
upon the code you place in the
JavaScript
function referenced, which in this case I've named
someFunction
.
Note: the onresize attribute is new to HTML5 and isn't supported in HTML 4.01 and older versions oF HTML. You can expect current versions of browsers to support it, but if a visitor has an outdated browser version, the function may not work for the visistor.
[ More Info ]