mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
more tweeking and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
bae0693c9f
commit
55a38d6b9e
@ -469,8 +469,8 @@ function shiftTo(image, ribbon){
|
|||||||
var cur_ribbon = image.closest('.ribbon')
|
var cur_ribbon = image.closest('.ribbon')
|
||||||
|
|
||||||
// insert before the first image if nothing is before the target...
|
// insert before the first image if nothing is before the target...
|
||||||
if(target == null){
|
if(target.length == 0){
|
||||||
image.insertBefore($(ribbon).find('.image').first())
|
image.prependTo($(ribbon))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
image.insertAfter(target)
|
image.insertAfter(target)
|
||||||
@ -484,7 +484,6 @@ function shiftTo(image, ribbon){
|
|||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX this needs to account for last image in ribbon...
|
|
||||||
function shiftImage(direction, image, force_create_ribbon){
|
function shiftImage(direction, image, force_create_ribbon){
|
||||||
if(image == null){
|
if(image == null){
|
||||||
// XXX need to make this context specific...
|
// XXX need to make this context specific...
|
||||||
@ -492,14 +491,15 @@ function shiftImage(direction, image, force_create_ribbon){
|
|||||||
} else {
|
} else {
|
||||||
image = $(image)
|
image = $(image)
|
||||||
}
|
}
|
||||||
var ribbon = image.closest('.ribbon')[direction]('.ribbon')
|
var old_ribbon = image.closest('.ribbon')
|
||||||
|
var ribbon = old_ribbon[direction]('.ribbon')
|
||||||
|
|
||||||
// need to create a new ribbon...
|
// need to create a new ribbon...
|
||||||
if(ribbon.length == 0 || force_create_ribbon == true){
|
if(ribbon.length == 0 || force_create_ribbon == true){
|
||||||
ribbon = createRibbon()['insert' + (direction == 'prev'
|
ribbon = createRibbon()['insert' + (direction == 'prev'
|
||||||
? 'Before'
|
? 'Before'
|
||||||
: 'After')](image.closest('.ribbon'))
|
: 'After')](old_ribbon)
|
||||||
ribbon.append(image)
|
shiftTo(image, ribbon)
|
||||||
} else {
|
} else {
|
||||||
shiftTo(image, ribbon)
|
shiftTo(image, ribbon)
|
||||||
}
|
}
|
||||||
@ -525,7 +525,8 @@ function _shiftImageTo(image, direction, moving, force_create_ribbon){
|
|||||||
flashIndicator(direction)
|
flashIndicator(direction)
|
||||||
|
|
||||||
shiftImage(direction, image, force_create_ribbon)
|
shiftImage(direction, image, force_create_ribbon)
|
||||||
return centerImage(focusImage(target))
|
// XXX does this need to be animated???
|
||||||
|
return centerImage(focusImage(target), 'css')
|
||||||
}
|
}
|
||||||
function shiftImageUp(image){
|
function shiftImageUp(image){
|
||||||
return _shiftImageTo(image, 'prev')
|
return _shiftImageTo(image, 'prev')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user