Resizethewindowtotriggerevent.

&am"/>

Resizethewindowtotriggerevent.

&am">

Home  >  Article  >  Web Front-end  >  Execute a script in HTML when the browser window size changes?

Execute a script in HTML when the browser window size changes?

WBOY
WBOYforward
2023-08-28 11:25:06739browse

Execute a script in HTML when the browser window size changes?

The onresize property is triggered when the web browser window is resized.

Example

You can try running the following code to implement the onresize attribute -

<!DOCTYPE html>
<html>
   <body onresize = "display()">
      <p>Resize the window to trigger event.</p>
      <script>
         function display() {
            alert("Web browser window resized!");
         }
      </script>
   </body>
</html>

The above is the detailed content of Execute a script in HTML when the browser window size changes?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete

Related articles

See more