Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-08-04 19:47:13 +04:00
parent 09be2834b7
commit 8e47044410

View File

@ -460,10 +460,12 @@ var getImageBefore = getImageBefore_bin
/********************************************************** Actions **/ /********************************************************** Actions **/
// basic actions... // basic actions...
// NOTE: below 'direction' is meant in the html sence, i.e. next/prev... // NOTE: below 'direction' argument is meant in the html sence,
// i.e. next/prev...
// create ribbon above/below helpers... // create ribbon above/below helpers...
// XXX // XXX adding a ribbon above the current is still jumpy, need to devise
// a cleaner fix...
function createRibbon(direction){ function createRibbon(direction){
if(direction == 'next'){ if(direction == 'next'){
var insert = 'insertAfter' var insert = 'insertAfter'
@ -473,48 +475,33 @@ function createRibbon(direction){
return false return false
} }
// XXX adding a new ribbon above the current effectively pushes the // adding a new ribbon above the current effectively pushes the
// whole view down... // whole view down, so we need to compensate for this.
// ...need to compensate for this!!! // NOTE: the problem is partly caused by clicks fiering BEFORE the
// PARTIAL-FIX: still jumps around... // animation is done...
// ...one way to try is to disable transitions temporaritly while
// adding a ribbon...
// XXX the problem is partly caused by clicks fiering BEFORE the
// animation is done...
// ...this can be systematically solved by adding a clickCurrent
// function that will wait till the animations are done...
$('.field').addClass('unanimated') $('.field').addClass('unanimated')
//doWithoutTransitions($('.field'), function(){ // need to account for increased top when creating a ribbon above...
// need to account for increased top when creating a ribbon above... if(direction == 'prev'){
// i.e. shift the content upward... $('.field').css({
if(direction == 'prev'){ 'margin-top': parseInt($('.field').css('margin-top')) - $('.current.ribbon').outerHeight()
$('.field').css({ })
'margin-top': parseInt($('.field').css('margin-top')) - $('.current.ribbon').outerHeight() }
}) // the actual insert...
} var res = $('<div class="ribbon"></div>')[insert]('.current.ribbon')
var res = $('<div class="ribbon"></div>')[insert]('.current.ribbon')
/*
var res = $('<div class="new-ribbon"></div>')[insert]('.current.ribbon')
// HACK: without this, the class change below will not animate...
.show()
.addClass('ribbon')
.removeClass('new-ribbon')
*/
//})
// restore the animated state...
$('.field').removeClass('unanimated') $('.field').removeClass('unanimated')
//return $('.current.ribbon')['direction']('.ribbon')
return res return res
} }
// XXX sort elements correctly... // XXX sort elements correctly...
// XXX this uses jquery animation...
function mergeRibbons(direction){ function mergeRibbons(direction){
// XXX do these one by one...
$('.current.ribbon')[direction]('.ribbon') $('.current.ribbon')[direction]('.ribbon')
.children() .children()
.detach() .detach()