Skip to content

Commit 54c677a

Browse files
committed
Add animation in image preview
1 parent c942911 commit 54c677a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ a, a:hover {
5858
right: 10%;
5959
bottom: 10%;
6060
left: 10%;
61+
background: rgba(0, 0, 0, 0.5);;
62+
transition: width 200ms, height 200ms, left 200ms;
6163
text-align: center;
6264
}
6365

app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ var app = function(){
3737
function cd(dir) {
3838
current_dir = dir;
3939

40-
console.log(current_dir, base_dir);
4140
location.hash = current_dir.replace(base_dir, '');
4241

4342
// show the location bar
@@ -91,12 +90,16 @@ var app = function(){
9190
// show an image preview of the given file
9291
function showPreview(filepath){
9392
$(".bg-translucent").css('display', 'block');
93+
$(".file-view-img").css('padding-top', '2em');
9494
$(".file-view-img").attr('src', 'loader.gif');
9595
$(".file-view-wrapper").css('display', 'block');
9696
var img = new Image();
9797
img.src = filepath;
9898
img.onload = function() {
99+
$(".file-view-img").fadeOut(0);
100+
$(".file-view-img").css('padding-top', '0');
99101
$(".file-view-img").attr('src', filepath);
102+
$(".file-view-img").fadeIn();
100103
var scale_width = 0.8 * $(document).width() / img.width;
101104
var scale_height = 0.8 * $(document).height() / img.height;
102105
var imgWidth = img.width * Math.min(scale_width, scale_height);

0 commit comments

Comments
 (0)