]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix imageviewer again
authorRobin Appelman <icewind1991@gmail.com>
Sat, 4 Jun 2011 20:41:17 +0000 (22:41 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Sat, 4 Jun 2011 20:41:17 +0000 (22:41 +0200)
apps/files_imageviewer/css/lightbox.css
apps/files_imageviewer/js/lightbox.js

index d5a1c335146729ecce8201b3a4b2960660945aeb..a6e844a2e28b58e08051c6f19c1fd6abcccb9df8 100644 (file)
@@ -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;
index e29bc510ee361ac51c7d8af7e0211a00682e566b..5f15c7869141d91b145c5fea9e8811f2d04c3c26 100644 (file)
@@ -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