From 85a86808e0639ddd3b56f27b25507e45068df3fd Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 5 Apr 2014 20:04:05 +0200 Subject: [PATCH] add maxHeight function --- public/js/vroom.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 4205ff2..b81b74f 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -103,6 +103,12 @@ function initVroom(room) { el.mozRequestFullScreen(); } + // get max height for the main video and the preview div + function maxHeight(){ + // Which is the window height, minus toolbar, and a margin of 25px + return $(window).height()-$('#toolbar').height()-25; + } + // Logout function hangupCall(){ webrtc.connection.disconnect(); @@ -175,7 +181,7 @@ function initVroom(room) { else { $('#mainVideo').html($(video).clone().dblclick(function() { fullScreen(this); - }).css('max-height', $(window).height()-$('#toolbar').height()-25)).bind("contextmenu", function(){ return false; }); + }).css('max-height', maxHeight()).bind("contextmenu", function(){ return false; })); $('.selected').removeClass('selected'); $(this).addClass('selected'); mainVid = id; @@ -530,7 +536,7 @@ function initVroom(room) { else{ $('#mainVideo').html($(this).clone().dblclick(function() { fullScreen(this); - }).css('max-height', $(window).height()-$('#toolbar').height()-25)); + }).css('max-height', maxHeight())); $('.selected').removeClass('selected'); $(this).addClass('selected'); mainVid = 'self'; @@ -610,10 +616,10 @@ function initVroom(room) { // Preview heigh is limited to the windows heigh, minus the navbar, minus 25px window.onresize = function (){ - $('#webRTCVideo').css('max-height', $(window).height()-$('#toolbar').height()-25); - $('#mainVideo>video').css('max-height', $(window).height()-$('#toolbar').height()-25); + $('#webRTCVideo').css('max-height', maxHeight()); + $('#mainVideo>video').css('max-height', maxHeight()); }; - $('#webRTCVideo').css('max-height', $(window).height()-$('#toolbar').height()-25); + $('#webRTCVideo').css('max-height', maxHeight()); };