mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 10:50:08 +00:00
found and documented a bug -- will resolve later...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
111ef43865
commit
61fe3d22df
@ -33,7 +33,8 @@ TODO:
|
|||||||
- merge almost identical functions...
|
- merge almost identical functions...
|
||||||
|
|
||||||
ISSUES:
|
ISSUES:
|
||||||
- jumping...
|
- jumping on focus up/down...
|
||||||
|
- demoting a first element (a ribbon is created) positions the field incorrectly (see demoteImage() for details)...
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script src="jquery.js"></script>
|
<script src="jquery.js"></script>
|
||||||
@ -214,13 +215,19 @@ function focusBelowRibbon(){
|
|||||||
|
|
||||||
|
|
||||||
// create ribbon above/below helpers...
|
// create ribbon above/below helpers...
|
||||||
|
// XXX NOTE: this will shift the content downwards...
|
||||||
function createRibbonAbove(){
|
function createRibbonAbove(){
|
||||||
return $('<div class="new-ribbon"></div>')
|
var res = $('<div class="new-ribbon"></div>')
|
||||||
.insertBefore('.current-ribbon')
|
.insertBefore('.current-ribbon')
|
||||||
// HACK: without this, the class change below will not animate...
|
// HACK: without this, the class change below will not animate...
|
||||||
.show()
|
.show()
|
||||||
.addClass('ribbon')
|
.addClass('ribbon')
|
||||||
.removeClass('new-ribbon')
|
.removeClass('new-ribbon')
|
||||||
|
// XXX find a better way to do this...
|
||||||
|
$('.field').css({
|
||||||
|
top: $('.field').position().top - $('.current-ribbon').outerHeight()
|
||||||
|
})
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRibbonBelow(){
|
function createRibbonBelow(){
|
||||||
@ -290,25 +297,31 @@ function promoteImage(){
|
|||||||
|
|
||||||
// XXX sort elements correctly...
|
// XXX sort elements correctly...
|
||||||
// XXX do animations...
|
// XXX do animations...
|
||||||
|
// XXX BUG: when demoting first image (new ribbon created) it gets focused...
|
||||||
|
// REASON: .click() gets called in several places BEFORE the animation is done...
|
||||||
|
// NOTE: this bog does not affect promoteImage -- adding a lower element does not affect current positioning...
|
||||||
function demoteImage(){
|
function demoteImage(){
|
||||||
if($('.current-ribbon').prev('.ribbon').length == 0){
|
if($('.current-ribbon').prev('.ribbon').length == 0){
|
||||||
createRibbonAbove()
|
var new_ribbon = createRibbonAbove()
|
||||||
}
|
}
|
||||||
// XXX sort elements correctly...
|
// XXX sort elements correctly...
|
||||||
if($('.current-ribbon').children('.image').length == 1){
|
if($('.current-ribbon').children('.image').length == 1){
|
||||||
// XXX this adds image to the head while thebelow portion adds it to the tail...
|
// XXX this adds image to the head while the below portion adds it to the tail...
|
||||||
mergeRibbonsUp()
|
mergeRibbonsUp()
|
||||||
} else {
|
} else {
|
||||||
img = $('.current-image')
|
img = $('.current-image')
|
||||||
if(img.next('.image').length == 0){
|
if(img.next('.image').length == 0){
|
||||||
|
// XXX in case when we've just created an empty ribbon, the click in this fires BEFORE it is fully expanded...
|
||||||
prevImage()
|
prevImage()
|
||||||
} else {
|
} else {
|
||||||
|
// XXX in case when we've just created an empty ribbon, the click in this fires BEFORE it is fully expanded...
|
||||||
nextImage()
|
nextImage()
|
||||||
}
|
}
|
||||||
img
|
img
|
||||||
.detach()
|
.detach()
|
||||||
.appendTo($('.current-ribbon').prev('.ribbon'))
|
.appendTo($('.current-ribbon').prev('.ribbon'))
|
||||||
}
|
}
|
||||||
|
// XXX in case when we've just created an empty ribbon, the click in this fires BEFORE it is fully expanded...
|
||||||
$('.current-image').click()
|
$('.current-image').click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user