Sublime Text
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> </head> <body> <button type="button">Click here</button> <p>- Số sự kiện resize() đã xảy ra: <span>0</span></p> <script> var a = 0; $(document).ready(function(){ $("button").click(function(){ $(window).resize(); }); $(window).resize(function(){ a = a + 1; $("span").html(a); }); }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> </head> <body> <button type="button">Click here</button> <p>- Số sự kiện resize() đã xảy ra: <span>0</span></p> <script> var a = 0; $(document).ready(function(){ $("button").click(function(){ $(window).resize(); }); $(window).resize(function(){ a = a + 1; $("span").html(a); }); }); </script> </body> </html>