diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-06-05 00:41:17 +0400 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-06-05 00:41:17 +0400 |
commit | b0476bf1745b58e1b4802223902212a274bc19e1 (patch) | |
tree | 50823ee19508445b331d37d9aa9df1109f241a22 | |
parent | 40a96aab28a67c3ab580be4d0228e78a68409123 (diff) |
fix imageviewer again
-rw-r--r-- | apps/files_imageviewer/css/lightbox.css | 2 | ||||
-rw-r--r-- | apps/files_imageviewer/js/lightbox.js | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/apps/files_imageviewer/css/lightbox.css b/apps/files_imageviewer/css/lightbox.css index d5a1c335146..a6e844a2e28 100644 --- a/apps/files_imageviewer/css/lightbox.css +++ b/apps/files_imageviewer/css/lightbox.css @@ -1,5 +1,6 @@ #lightbox_overlay{ position:fixed; + display:none; height:100%; width:100%; top:0px; @@ -12,6 +13,7 @@ #lightbox{ position:fixed; + display:none; max-height:90%; max-width:90%; top:10px; diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js index e29bc510ee3..5f15c786914 100644 --- a/apps/files_imageviewer/js/lightbox.js +++ b/apps/files_imageviewer/js/lightbox.js @@ -1,12 +1,13 @@ var lightBoxShown=false; $(document).ready(function() { images={};//image cache + var overlay=$('<div id="lightbox_overlay"/>'); + $( 'body' ).append(overlay); + var container=$('<div id="lightbox"/>'); + $( 'body' ).append(container); FileActions.register('image','View',function(filename){ var location='ajax/download.php?files='+filename+'&dir='+$('#dir').val(); - var overlay=$('<div id="lightbox_overlay"/>'); - $( 'body' ).append(overlay); - var container=$('<div id="lightbox"/>'); - $( 'body' ).append(container); + overlay.show(); if(!images[location]){ var img = new Image(); img.onload = function(){ @@ -39,12 +40,16 @@ function showLightbox(container,img){ container.append(img); container.css('top',Math.round( ($( window ).height() - img.height)/2)); container.css('left',Math.round( ($( window ).width() - img.width)/2)); - lightBoxShown=true; + $('#lightbox').show(); + setTimeout(function(){ + lightBoxShown=true; + },100); } function hideLightbox(){ if(lightBoxShown){ - $('#lightbox_overlay').remove(); - $('#lightbox').remove(); + $('#lightbox_overlay').hide(); + $('#lightbox').hide(); + lightBoxShown=false; } }
\ No newline at end of file |