Jquery 循环幻灯片中的辅助动画不起作用,除非它是第一张幻灯片
我的项目的目标是制作图像幻灯片,每个图像顶部都有一个下拉菜单,仅使用 .animate。然而,这仅适用于第一张幻灯片,在其余幻灯片上它们似乎不起作用。每张幻灯片都是一个 div,该 div 内部是 div #panel。
var $panel = $('#panel');
var $up = $("#up");
var $down = $("#down");
// up arrow
$up.click(function () {
$panel.animate({
top: '-180px',
}, 500);
$(this).fadeOut(250);
$down.fadeIn(250);
return false;
});
// down arrow
$down.click(function () {
$panel.animate({
top: '0',
}, 500);
$(this).fadeOut(250);
$up.fadeIn(250);
return false;
});
哦,还有循环代码:
$('#base').cycle({
fx:'scrollHorz',
prev: '#prev',
next: '#next',
timeout: 0,
});
The goal for my project was to make a slideshow of images, with a dropdown at the top of each of them just using .animate. However, this only works on the first slide, On the rest they don't seem to work whatsoever. Each slide is a div, and inside that div is the div #panel.
var $panel = $('#panel');
var $up = $("#up");
var $down = $("#down");
// up arrow
$up.click(function () {
$panel.animate({
top: '-180px',
}, 500);
$(this).fadeOut(250);
$down.fadeIn(250);
return false;
});
// down arrow
$down.click(function () {
$panel.animate({
top: '0',
}, 500);
$(this).fadeOut(250);
$up.fadeIn(250);
return false;
});
Oh and the cycle code:
$('#base').cycle({
fx:'scrollHorz',
prev: '#prev',
next: '#next',
timeout: 0,
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从外观上看,您似乎为每个下拉元素使用了相同的 ID。每个元素都应该有自己唯一的 ID。尝试为每个元素使用类,例如:
From the look of it, it seems like you are using the same IDs for each drops down element. Each element should have its own unique ID. Try using classes for each element instead such as: