简体   繁体   中英

Changing browser height not detected by .resize function

I am using the .resize function to trigger some adjustments. When I decrease/increase the browser width size it works ok, but when I decrease/increase the browser height nothing happens. Any idea why changing the browser height does not get detected by the .resize function? (same behavior in Chrome and IE9)

Something like this should do what you want:

document.body.style.overflow = 'hidden'; // hide the scroll bars
$(window).resize(function(){
  var newwidth = $(window).width();
  var newheight = $(window).height();      
  $("#elementId").height(newheight).width(newwidth);
});

DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM