我正在尝试使用jQuery创建照片库,因此当我单击缩略图时,通过淡入它会变成“缩放框”。然后用左右箭头导航,并使用如下所示的函数loadContentFrom(domObject) :
function loadContentFrom(domObject)
{
// metaspan is gonna be the content of #zoombox :
var metaspan = domObject.children('.metaspan');
// set the html by fading in :
$("#zoombox").html(metaspan.html()).fadeIn(400);
add_left_right_arrows_to_zoombox();
// also set the background to be clickable for exit.
$("#exitdiv").fadeIn(400);
}
当我单击domObject时,它会逐渐变亮。但是,当我单击左-右箭头时,它调用
loadContentFrom(selectedDomObject.next('.domobject'));
,但由于zoombox已被淡入,因此会立即更改内容。因此,如何设置它先淡出当前内容,然后淡出新内容?
谢谢 !
最佳答案
像这样..
function loadContentFrom(domObject)
{
// metaspan is gonna be the content of #zoombox :
var metaspan = domObject.children('.metaspan');
// set the html by fading in :
$("#zoombox").html(metaspan.html()).fadeIn(400);
add_left_right_arrows_to_zoombox();
// also set the background to be clickable for exit.
$("#exitdiv").hide().fadeIn(400);
}