Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can jQuery change `$(window).width()`?

Tags:

jquery

Is it possible to change $(window).width() via jQuery, so that something like this is possible:

$('#click').click(function(){
   //menu 100px with $(window).width();
});
like image 216
cj333 Avatar asked Sep 16 '11 22:09

cj333


2 Answers

No it's not. The underlying DOM element itself doesn't support modifying the width of the browser window. It is possible to change the dimensions of the content (outerWidth / innerWidth) area. However I don't believe this has an affect on the size of the window which is what you seem to want to achieve

like image 159
JaredPar Avatar answered Oct 10 '22 06:10

JaredPar


You can control the size of a new browser window that you open with window.open(). See https://developer.mozilla.org/En/Window.open for how to do that.

like image 21
jfriend00 Avatar answered Oct 10 '22 06:10

jfriend00