diff --git a/ui/gallery-prototype.js b/ui/gallery-prototype.js index 13400cc6..838eccf9 100755 --- a/ui/gallery-prototype.js +++ b/ui/gallery-prototype.js @@ -352,6 +352,18 @@ function focusBelowRibbon(){ /********************************************************** Helpers **/ +function doWithoutTransitions(obj, func){ + obj + .addClass('unanimated') + .one("webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend", function(){ + func() + $('.viewer') + .one("webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend", function(){ + obj.removeClass('unanimated') + }) + }) +} + // find an image object after which to position image ID... // used for two main tasks: // - positioning promoted/demoted images @@ -472,23 +484,30 @@ function createRibbon(direction){ // ...this can be systematically solved by adding a clickCurrent // function that will wait till the animations are done... - // need to account for increased top when creating a ribbon above... - // i.e. shift the content upward... - if(direction == 'prev'){ - $('.field').css({ - 'margin-top': parseInt($('.field').css('margin-top')) - $('.current.ribbon').outerHeight() - }) - } + $('.field').addClass('unanimated') + + //doWithoutTransitions($('.field'), function(){ + // need to account for increased top when creating a ribbon above... + // i.e. shift the content upward... + if(direction == 'prev'){ + $('.field').css({ + 'margin-top': parseInt($('.field').css('margin-top')) - $('.current.ribbon').outerHeight() + }) + } - var res = $('
')[insert]('.current.ribbon') - /* - var res = $('
')[insert]('.current.ribbon') - // HACK: without this, the class change below will not animate... - .show() - .addClass('ribbon') - .removeClass('new-ribbon') - */ + var res = $('
')[insert]('.current.ribbon') + /* + var res = $('
')[insert]('.current.ribbon') + // HACK: without this, the class change below will not animate... + .show() + .addClass('ribbon') + .removeClass('new-ribbon') + */ + //}) + + $('.field').removeClass('unanimated') + //return $('.current.ribbon')['direction']('.ribbon') return res } @@ -548,8 +567,7 @@ function shiftImage(direction){ } // XXX this has to know about animations... - //$('.current.image').click() - clickAfterTransitionsDone() + $('.current.image').click() } diff --git a/ui/gallery.css b/ui/gallery.css index 0d0b6bac..0a201725 100755 --- a/ui/gallery.css +++ b/ui/gallery.css @@ -1,3 +1,20 @@ +.animated { + -webkit-transition: all 0.2s ease; + -moz-transition: all 0.2s ease; + -o-transition: all 0.2s ease; + -ms-transition: all 0.2s ease; + transition: all 0.2s ease; +} + +.unanimated { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + -ms-transition: none; + transition: none; +} + + .image { float: left;