reversing swipe, added animation for changing images

This commit is contained in:
ville rantanen
2013-07-23 15:45:19 +03:00
parent 8c10d71801
commit 502b817b63

View File

@@ -976,18 +976,34 @@ function showimage(i) {
// Main function to show a single image // Main function to show a single image
if (i>imagelist.length-1 || i<0) { return; } if (i>imagelist.length-1 || i<0) { return; }
thumblist(i,i); thumblist(i,i);
var dirStr=$('#imagecontainer').data('ID')<i ? '-' : '+';
var revDirStr=$('#imagecontainer').data('ID')<i ? '+' : '-';
$('#imagecontainer').clearQueue();
$('#imagecontainer').stop();
$('#imagecontainer').css('margin-left', '0px');
$('#imagecontainer').css('opacity', '1');
$('#imagecontainer').animate({
'marginLeft' : dirStr+"=200px",
'opacity' : "-=1"
},100, function() {
$('#imagecontainer').css('margin-left', revDirStr+'200px');
showbigimage(i); showbigimage(i);
preload(i); preload(i);
subfoldersmalllist(); subfoldersmalllist();
currentimage=i; currentimage=i;
setProgress(i); setProgress(i);
$('#imagecontainer').animate({
'marginLeft' : dirStr+"=200px",
'opacity' : "+=1"
},50);
});
return; return;
} }
function showbigimage(i) { function showbigimage(i) {
// The medium version of image in the big image container // The medium version of image in the big image container
if (i==-1) { return; } if (i==-1) { return; }
var width=document.body.clientWidth-30; var width=document.body.clientWidth-30;
var height=document.body.clientHeight-225; var height=document.body.clientHeight-225;
if (fullscreen) { height=height+200; } if (fullscreen) { height=height+200; }
@@ -1014,6 +1030,7 @@ function showbigimage(i) {
$('#imagesingle').css('background-image','url("_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg")'); $('#imagesingle').css('background-image','url("_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg")');
} }
$('#imagecontainer').css('height',height); $('#imagecontainer').css('height',height);
$('#imagecontainer').data('ID',i);
$('#prevTouch').click(function() { $('#prevTouch').click(function() {
currentimage-=1; currentimage-=1;
if (currentimage<0) { currentimage=imagelist.length-1; } if (currentimage<0) { currentimage=imagelist.length-1; }
@@ -1743,19 +1760,18 @@ function notsupported() {
function addswipe(divname) { function addswipe(divname) {
$(divname).swipe({ $(divname).swipe({
swipe:function(event, direction, distance, duration, fingerCount) { swipe:function(event, direction, distance, duration, fingerCount) {
if (direction=='left') { if (direction=='right') {
currentimage-=1; currentimage-=1;
if (currentimage<0) { currentimage=imagelist.length-1; } if (currentimage<0) { currentimage=imagelist.length-1; }
showimage(currentimage); showimage(currentimage);
} }
if (direction=='right') { if (direction=='left') {
currentimage+=1; currentimage+=1;
if (currentimage>(imagelist.length-1)) { currentimage=0; } if (currentimage>(imagelist.length-1)) { currentimage=0; }
showimage(currentimage); showimage(currentimage);
} }
if (direction=='up') { if (direction=='up') { flipfullscreen(); }
flipfullscreen(); if (direction=='down') { usersetupflip(); }
}
} }
}); });
} }