mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +00:00
ribbon merge not works correctly -- puts images in correct positions...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8e47044410
commit
c32bd5a253
@ -498,14 +498,39 @@ function createRibbon(direction){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// merge current and direction ribbon...
|
||||||
|
// NOTE: this will take all the elements from direction ribbon and add
|
||||||
|
// them to current
|
||||||
// XXX sort elements correctly...
|
// XXX sort elements correctly...
|
||||||
// XXX this uses jquery animation...
|
// XXX this uses jquery animation...
|
||||||
function mergeRibbons(direction){
|
function mergeRibbons(direction){
|
||||||
|
/*
|
||||||
// XXX do these one by one...
|
// XXX do these one by one...
|
||||||
$('.current.ribbon')[direction]('.ribbon')
|
$('.current.ribbon')[direction]('.ribbon')
|
||||||
.children()
|
.children()
|
||||||
.detach()
|
.detach()
|
||||||
.insertAfter('.current.image')
|
.insertAfter('.current.image')
|
||||||
|
*/
|
||||||
|
|
||||||
|
var current_ribbon = $('.current.ribbon')
|
||||||
|
var images = $('.current.ribbon')[direction]('.ribbon').children()
|
||||||
|
// XXX one way to optimise this is to add the lesser ribbon to the
|
||||||
|
// greater...
|
||||||
|
for(var i=0; i < images.length; i++){
|
||||||
|
// get previous element after which we need to put the current...
|
||||||
|
var image = $(images[i])
|
||||||
|
var prev_elem = getImageBefore(image.attr('id'), current_ribbon)
|
||||||
|
if(prev_elem == null){
|
||||||
|
image
|
||||||
|
.detach()
|
||||||
|
.insertBefore(current_ribbon.children('.image').first())
|
||||||
|
} else {
|
||||||
|
image
|
||||||
|
.detach()
|
||||||
|
.insertAfter(prev_elem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// animate...
|
// animate...
|
||||||
$('.current.ribbon')[direction]('.ribbon')
|
$('.current.ribbon')[direction]('.ribbon')
|
||||||
.slideUp(function(){
|
.slideUp(function(){
|
||||||
|
|||||||
@ -138,8 +138,8 @@ $(document).ready(setup);
|
|||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
<button onclick="mergeRibbonsUp()">merge ribbons up</button><br>
|
<button onclick="mergeRibbons('prev')">merge ribbons up</button><br>
|
||||||
<button onclick="mergeRibbonsDown()">merge ribbons down</button>
|
<button onclick="mergeRibbons('next')">merge ribbons down</button>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user