jquery - How to stop resize when meet the width size of an element -


i wanted #map element resize whenever window resize. however, if browser window resize , meet 930 pixel width, #map element should stop resizing if browser extend full screen width.

here's actual code.

$(window).on('resize',function(){   var _framey = $(window).height(),       _framex = $(window).width(),       _map    = $('#map');    if (_framex <= _map.width()) {     _map.css({ 'width': _framex, 'height': _framey });   } else if (_framex >= 930) {     _map.css({ 'width': _framex, 'height': _framey });   }  }).resize(); 

i wanted maintain resizing function below 930 pixel of #map, when browser screen-width resize , on 931 pixel, #map element should stop resizing , stay @ 930 pixel width.

this part wrong because ".width()" return current width of element , not value in css element. have set in code 930px value in condition.

  if (_framex <= _map.width()) {     _map.css({ 'width': _framex, 'height': _framey });   } else if (_framex >= 930) {     _map.css({ 'width': _framex, 'height': _framey });   } 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -