javascript - jQuery width change detection -


is now resolved, thanks

I have a lot of close answers For my problem with resizing () appears here, my code is: 'big' () is a layout function that I want to call when the screen orientation> 501, 'small (regardless of device orientation) 'There is a function that I want to call when the width of the screen is; 501

I have my problem I do not want these functions to be called when the window will change. Note that in my page I am using an ampsion in the mobile view and if I extend an Aronian panel, then it adds the height of the page, even if the browser window is not re-shaped. JQuery sees it as a window.resize.

$ (window). Reset (function (e) {var winWidth = $ (window). Width (); if (winWidth> = 501) {large ();} If (winwidth <501) {small ();}}) ;

Any answer is appreciated, and I know that I need to clarify anything.

I jquery-1.11.0.min.js jquery-ui-1.10.3.custom.min.js

Thanks

with the post-text about how to store the context of the previous width and if the width is again in size If you have changed then call your work - otherwise leave it. This is because:

  // If you do not want to change it for the first time // set this value to document window for initial window width prevWinWidth = 0; $ (Window). Reset (function (e) {var winWidth = $ (window). Width (); if (winWidth! = PrevWinWidth) {if (winWidth> = 501) {big ();} if (winWidth <501) {short ();} PrevWinWidth = winWidth;}});  

Comments