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