added ribbon align for prev and next ribbons...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-07-31 17:38:50 +04:00
parent 12852e10a7
commit d51f567a15
2 changed files with 18 additions and 3 deletions

View File

@ -93,7 +93,21 @@ function setCurrentImage(){
centerSquare()
// center other ribbons relative to current image...
// XXX
// XXX only two ribbons are positioned at this point...
var id = $('.current.image').attr('id')
var directions = ['prev', 'next']
for(var i in directions){
var ribbon = $('.current.ribbon')[directions[i]]('.ribbon')
if(ribbon.length == 1){
var img = getImageBefore(id, ribbon)
if(img != null){
alignRibbon(img, 'before')
} else {
// there are no images before...
alignRibbon(ribbon.children('.image').first(), 'after')
}
}
}
}
@ -134,6 +148,7 @@ function handleImageClick(e) {
// this sets the zooming factor used in manual zooming...
var ZOOM_FACTOR = 2
// key configuration...

View File

@ -121,13 +121,13 @@ function alignRibbon(image, position){
switch(position){
case 'before':
ribbon.css({'margin-left': h_offset + w/2})
ribbon.css({'margin-left': h_offset - w/2})
return true
case 'center':
ribbon.css({'margin-left': h_offset})
return true
case 'after':
ribbon.css({'margin-left': h_offset - w/2})
ribbon.css({'margin-left': h_offset + w/2})
return true
}
return false