【发布时间】:2013-10-02 21:35:06
【问题描述】:
我想在单击按钮后显示一段时间的图像,并且在显示图像时,我想隐藏按钮。 这是我的代码
function showimage(button, image, imagesrc){
$(button).click(function(){
if ($('img#'+image).length === 0) {
$('<img id=' + image + ' src=' + imagesrc + ' style={display: none;}>').insertBefore(button);
}
$(button).hide();
$('img#'+image).slideDown(500).delay(2000).slideUp(500);
$(button).show();
});
};
但是show() 和hide() 不会跟随延迟,我该怎么办?
【问题讨论】:
-
.hide(0) or .show(0)放入队列 -
为什么要将点击事件封装在一个函数中?
标签: jquery