Javascript detect resize of div using event listener not triggering function -
i have resizable div event listener , function attached it.
here code:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> #el { border: 2px solid #333; padding: 20px; width: 300px; resize: both; overflow: auto; } </style> </head> <body> <div id="el"> let user resize div element. </div> <script> function myfunction(){ console.log('el resized'); } div_elm = document.getelementbyid('el'); div_elm.addeventlistener("resize", myfunction); </script> </body> </html>
the problem function not firing when div resized.
how can fix this?
Comments
Post a Comment