$("#show > div").click(function() {
var a = $(this).html();
alert (a); // 860
window.resizeTo(a + "px", 450 + "px");
});
The above is the accepted answer from this SO post.
But doesn't work. On click - nothing happens !
$("#show > div").click(function() {
var a = $(this).html();
alert (a); // 860
window.resizeTo(a + "px", 450 + "px");
});
The above is the accepted answer from this SO post.
But doesn't work. On click - nothing happens !
There is no way for a web page to resize the main browser window in Chrome. JavaScript code is only permitted to resize popup windows.
You can see in w3school an example for the resizeTo
function, used for resizing a popup:
http://www.w3schools.com/jsref/met_win_resizeto.asp
function openWin() {
myWindow = window.open("", "", "width=100, height=100"); // Opens a new window
}
function resizeWin() {
myWindow.resizeTo(250, 250); // Resizes the new window
myWindow.focus(); // Sets focus to the new window
}