mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-01 03:40:09 +00:00
made the shiftImage<Direction> methods a bit higher level...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0fb6a9fe51
commit
bfef177477
@ -149,7 +149,6 @@
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
opacity: 0.7;
|
||||
cursor: hand;
|
||||
}
|
||||
.up-indicator:after,
|
||||
@ -163,7 +162,7 @@
|
||||
bottom: -25px;
|
||||
left: 25px;
|
||||
|
||||
background: blue;
|
||||
background: yellow;
|
||||
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
@ -212,11 +211,8 @@ Split the API into the following sections:
|
||||
*/
|
||||
|
||||
|
||||
function flashUpIndicator(){
|
||||
$('.up-indicator').fadeIn(200).fadeOut(200)
|
||||
}
|
||||
function flashDownIndicator(){
|
||||
$('.down-indicator').fadeIn(200).fadeOut(200)
|
||||
function flashIndicator(direction){
|
||||
$(direction == 'prev' ? '.up-indicator' : '.down-indicator').fadeIn(200).fadeOut(200)
|
||||
}
|
||||
|
||||
|
||||
@ -486,6 +482,7 @@ function shiftTo(image, ribbon){
|
||||
return image
|
||||
}
|
||||
|
||||
// XXX this needs to account for last image in ribbon...
|
||||
function shiftImage(direction, image, force_create_ribbon){
|
||||
if(image == null){
|
||||
// XXX need to make this context specific...
|
||||
@ -508,17 +505,37 @@ function shiftImage(direction, image, force_create_ribbon){
|
||||
}
|
||||
|
||||
// short-hand methods...
|
||||
function _shiftImageTo(image, direction, moving, force_create_ribbon){
|
||||
if(image == null){
|
||||
image = $('.current.image')
|
||||
}
|
||||
|
||||
// account for direction...
|
||||
var a = moving == 'prev' ? 'prev' : 'next'
|
||||
var b = moving == 'prev' ? 'next' : 'prev'
|
||||
var target = image[a]('.image')
|
||||
|
||||
target = target.length == 0 ? image[b]() : target
|
||||
|
||||
// XXX should this be in here or coupled later via an event???
|
||||
flashIndicator(direction)
|
||||
|
||||
shiftImage(direction, image, force_create_ribbon)
|
||||
return centerImage(focusImage(target))
|
||||
}
|
||||
// XXX these need to focus on next/prev image depending on direction...
|
||||
// XXX these are virtually identical...
|
||||
function shiftImageUp(image){
|
||||
return shiftImage('prev', image)
|
||||
return _shiftImageTo(image, 'prev')
|
||||
}
|
||||
function shiftImageDown(image){
|
||||
return shiftImage('next', image)
|
||||
return _shiftImageTo(image, 'next')
|
||||
}
|
||||
function shiftImageUpNewRibbon(image){
|
||||
return shiftImage('prev', image, true)
|
||||
return _shiftImageTo(image, 'prev', true)
|
||||
}
|
||||
function shiftImageDownNewRibbon(image){
|
||||
return shiftImage('next', image, true)
|
||||
return _shiftImageTo(image, 'prev', false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user