From 065744c849f02a4c18e8436345f925ebf19ffb24 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 5 Jun 2012 16:28:47 +0400 Subject: [PATCH] ... Signed-off-by: Alex A. Naanou --- ui/gallery.html | 90 +++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/ui/gallery.html b/ui/gallery.html index d2eba534..260cd0b1 100755 --- a/ui/gallery.html +++ b/ui/gallery.html @@ -16,6 +16,9 @@ TODO: zoom in zoom out toggle single image + +ISSUES: + - jumping... --> @@ -24,6 +27,10 @@ TODO: $(document).ready(function() { $(".image").click(function(e) { + if($(this).hasClass('current-image')){ + //return true + } + // switch classes... $(this).parents().siblings().children(".image").removeClass("current-image"); $(this).siblings(".image").removeClass("current-image"); @@ -34,9 +41,6 @@ $(document).ready(function() { $(this).addClass("current-image"); $(this).parents(".ribbon").addClass("current-ribbon"); - e.preventDefault(); - - // move... var container = $(this).parents('.container') var field = $(this).parents(".field") var cur_ribbon = $(this).parents('.current-ribbon') @@ -46,16 +50,31 @@ $(document).ready(function() { var ribbon_offset = cur_ribbon.offset() var image_offset = cur_image.offset() + // center the current image... field.animate({ - top: parseInt(field.css('top'))+(container_offset.top - ribbon_offset.top) + (container.innerHeight()/2 - cur_image.outerHeight()/2), - left: parseInt(field.css('left'))+(container_offset.left - image_offset.left) + (container.innerWidth()/2 - cur_image.outerWidth()/2) - }) + // XXX need to make these more accurate and robust... + // XXX this is dependant on size and is really jumpy... + top: (container_offset.top - ribbon_offset.top + parseInt(field.css('top'))) + (container.innerHeight() - cur_image.outerHeight())/2, + left: (container_offset.left - image_offset.left + parseInt(field.css('left'))) + (container.innerWidth() - cur_image.outerWidth())/2 + }, 300) + + + e.preventDefault(); }); // set the default position... $('.current-image').click() }); +function prevImage(){ + $('.current-image').prev('.image').click() +} +function nextImage(){ + $('.current-image').next('.image').click() +} + + + @@ -189,4 +188,7 @@ $(document).ready(function() { - + + + +