Simple javascript / jquery window resize question -
i'm writting small script detect if window size larger initial screen size, write jquery handle css. problem i'm having if zoom in 1 notch on mouse wheel (ctrl + wheel scroll) works fine, zoom 1 notch doesn't go original value.
so screen 1920px wide. zoom in 1 notch on wheel, screen 1586px, fine. when zoom out 1 notch on wheel screen should 1920px (theoretically) it's not. zooms out 1903px , can't figure out why won't go 1920px.
here code, if more explanation or clarification needed, please let me know.
var intinitialsize = {width: screen.width, height: screen.height}; var intwindowsize = {width: $(window).width(), height: $(window).height()}; var int125; $(window).load(function() { calcmargin(); }).resize(function() { intwindowsize = {width: $(this).width(), height: $(this).height()}; //int125 = math.round(math.abs((intwindowsize.width * 1.25))); calcmargin(); }); function calcmargin() { console.log(intinitialsize.width, intwindowsize.width); if (intinitialsize.width >= intwindowsize.width) { // css stuff! } else { // other css stuff! } }
Comments
Post a Comment