Javascript newbie here,
I have this code with a button
<a href="#" onclick="javascript:popoutPlayer();">Popout</a>
Which triggers a window.open call
function popoutPlayer(){
window.open('popout.html', 'popout', 'width=645, height=363');
}
A new window opens up and I want to resize the window width and when I do I want the width to stay the same, but the height to change to 800
I have been working with this code
<script type="text/javascript">
var rtime = new Date();
var timeout = false;
var delta = 200;
$(window).resize(function() {
rtime = new Date();
if (timeout === false) {
timeout = true;
setTimeout(resizeend, delta);
}
});
function resizeend() {
if (new Date() - rtime < delta) {
setTimeout(resizeend, delta);
} else {
timeout = false;
//alert('Done resizing');
var windowWidth = $(window).width();
var windowHeight = $(window).height();
windowHeight = 800;
window.resizeTo($(window).width(), windowHeight);
}
}
</script>
But when the popout, pops out the height changes to 800, but the width gets smaller and small every 200 milliseconds.
What Am I doing wrong?