The resize () event provided by jquery was recently used in the foreground effect. Resize
This event is to monitor the browser window zoom in and out, that is, the size of the browser window changes.
I provided an example when I consulted the W3cschool. The source
- <</SPAN>html>
- <</SPAN>head>
- <</span>script type= "Text/javascript" src= "/jquery/jquery.js" ></</SPAN>script>
- <</span>script type= "Text/javascript" >
- x=0;
- $ (document). Ready (function () {
- $ (window). Resize (function () {
- $ ("span"). Text (x+=1);
- });
- $ ("button"). Click (function () {
- $ (window). Resize ();
- });
- });
- </</SPAN>script>
- </</SPAN>head>
- <</SPAN>body>
- The size of the <</SPAN>p> window is adjusted <</SPAN>span>0</</SPAN>span> times. </</SPAN>p>
- <</SPAN>p> try resizing your browser window. </</SPAN>p>
- <</SPAN>button> Resize events for trigger window </</SPAN>button>
- </</SPAN>body>
- </</SPAN>html>
As a result I zoomed in on the IE Environment Window resize event executed two times. Later I in Google and Baidu above query, there are two times in the IE environment to carry out the relevant information. Finally found a very good solution. A foreign askew has written a plugin specifically for the jquery.resize () event enhancement. The address is here: http://benalman.com/projects/jquery-resize-plugin/add "jquery.ba-resize.js" after adding jquery.js.
- <</SPAN>html>
- <</span>title>jquery-resize () </</SPAN>title>
- <</SPAN>head>
- <</span>script type= "Text/javascript" src= "Js/jquery.js" ></</SPAN>script>
- <</span>script type= "Text/javascript" src= "Js/jquery.ba-resize.js" ></</SPAN>script>
- <</span>script type= "Text/javascript" >
- x=0;
- $ (document). Ready (function () {
- $ (window). Resize (function () {
$ ("span"). Text (x+=1);
- });
- });
- </</SPAN>script>
- </</SPAN>head>
- <</SPAN>body>
- <</SPAN>p> window size has been adjusted <</SPAN>span>0</</SPAN>span> times. </</SPAN>p>
- <</SPAN>p> Please try resizing the browser window again. </</SPAN>p>
- </</SPAN>body>
- </</SPAN>html>
Solve the method of jquery.resize () executing multiple times in IE browser (GO)