Mercurial > hg > STI-GWT
view war/scripts/blockUI/FullscreenWindow.js @ 89:3700846b8590 trimmed_data tip
bug: removed leading / in url
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 15 Mar 2013 12:53:55 +0100 |
parents | cf06b77a8bbd |
children |
line wrap: on
line source
var fullscreen = new function(){ var loader = new Image(); loader.src = 'images/ajax-loader.gif'; this.fullscreens = []; this.zIndex = 5; this.margin = 20; this.loaderContent = function(){ var content = $("<div/>"); content.css('position','absolute'); content.append("<p id='statusText' style='text-align: center;color:white;'></p>"); content.append("<img src='images/ajax-loader.gif'/>"); return content; } this.addFullscreen = function(content){ var blockDiv = $("<div/>").appendTo('body'); blockDiv.addClass("blockDiv"); blockDiv.css('width',$(document).width()+'px'); blockDiv.css('height',$(document).height()+'px'); blockDiv.css('z-index',++this.zIndex); var overlay = $("<div/>").appendTo(blockDiv); overlay.addClass("blockDivOverlay"); overlay.css('width',$(document).width()+'px'); overlay.css('height',$(document).height()+'px'); $(content).appendTo(blockDiv); this.fullscreens.push({ content: content, overlay: overlay, blockDiv: blockDiv }); this.centerDiv(content); } this.centerDiv = function(div){ var left = Math.floor($(document).width()/2-div.width()/2); var top = Math.floor($(document).height()/2-div.height()/2); div.css('top', top+'px'); div.css('left', left+'px'); } this.removeFullscreen = function(){ $(this.fullscreens[this.fullscreens.length-1].blockDiv).remove(); this.fullscreens.pop(); } this.resize = function(){ for( var i in this.fullscreens ){ this.fullscreens[i].blockDiv.css('width',$(document).width()+'px'); this.fullscreens[i].blockDiv.css('height',$(document).height()+'px'); this.fullscreens[i].overlay.css('width',$(document).width()+'px'); this.fullscreens[i].overlay.css('height',$(document).height()+'px'); this.centerDiv(this.fullscreens[i].content); } } }