How to trigger the window resize event in jQuery ? Last Updated : 01 Jul, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report To discuss how to trigger the window resize event using jQuery. For this purpose, we will use the following library functions provided by jQuery.$(<element>).trigger(): This library function allows us to trigger both native and customized events. The method can be used independently or can be launched by another event. In this case, we will use the native JavaScript event 'resize' in order to trigger the resize event as per our convenience. The syntax would be: $(window).trigger('resize');$(<element>).resize(): This method is used to listen to resize events. The method can take callback functions as parameters, which will be executed once the resize event is encountered.jQuery CDN link:<script src=”https://code.jquery.com/jquery-3.5.1.min.js” integrity=”sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=” crossorigin=”anonymous”></script>Example: Here, the resize event will be triggered on a button for easier understandability. html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width,initial-scale=1.0"> <script src= "https://code.jquery.com/jquery-3.5.1.min.js" integrity= "sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"> </script> </head> <body> <button id="res" style=" background-color: green; color: white; font-size: 30px; border: none; border-radius: 28px; width: 200px; height: 100px; outline: none; cursor: pointer;"> Resize </button> <br> <p id="gfg" style>  (for Geeks For Geeks) </p> <script> $(document).ready(() => { $('#res').on('click', () => { $(window).trigger('resize'); }); $(window).resize(() => { console.log("resize function called"); }) }); </script> </body> </html> Output of the given Code Snippet: Comment More infoAdvertise with us Next Article How to get the size of screen, current web page and browser window using jQuery? T tirtharajsengupta Follow Improve Article Tags : JQuery CSS-Misc HTML-Misc jQuery-Misc Similar Reads How to use resize() function in jQuery ? In this article, we will learn about the resize() method which is an inbuilt method provided by jQuery. This method is used for binding an event listener to the resize event. This event is fired when the size of the browser window changes its size, either by the user or due to some other reason. Thi 2 min read How to detect when the window size is resized using JavaScript ? Sometimes when we develop our site, we want to detect the size of the window, In this article, we are going to learn how to detect when the window size is resized using JavaScriptThe window resize event occurs whenever the size of the browser window gets changed. We can listen to the resize event in 3 min read How to detect when the window size is resized using JavaScript ? Sometimes when we develop our site, we want to detect the size of the window, In this article, we are going to learn how to detect when the window size is resized using JavaScriptThe window resize event occurs whenever the size of the browser window gets changed. We can listen to the resize event in 3 min read How to make font-size that expands when we resize the window using jQuery ? In this article, we will learn how to increase or decrease the font-size of elements in HTML when the window is resized using jQuery. This can be used in situations where the font size has to be responsive according to the width of the browser window.Approach: We will be using the jQuery css(), widt 2 min read How to get the size of screen, current web page and browser window using jQuery? jQuery can be used to get the dimensions of the current page. The dimensions include the screen, viewport and document height, and width. Getting the window dimensions: Window size is the size of the browser window. This is the size that changes when the browser is resized. The windows height and wi 2 min read How to run a code on mouseenter event in jQuery ? In this article, we will see how to run the code when the mouse enters into the specific area using jQuery. To run the code on a mouse enter a specific area, mouseenter() method is used. The mouseenter() method works when the mouse pointer moves over the selected element. Syntax: $(selector).mouseen 1 min read Like