(。幻灯片显示fadeIn和fadeOut正常工作。)
注释return false和e.preventDefault,它看起来不起作用..
提前谢谢你。
if ($('.slideshow').length) {
$('.slideshow').cycle({
fx: 'scrollHorz',
speed: 'fast',
timeout: 0,
prev: '#prev',
next: '#next',
nowrap: 1,
before: onBefore,
after: onAfter,
pager: '#slide-pager ul',
pagerAnchorBuilder: function (idx, slide) {
// return selector string for existing anchor
return '#slide-pager ul li:eq(' + idx + ') a';
},
onPrevNextEvent: function (dir, id, el) {
if (dir === true) {
//alert('slide right');
if (id >= 3) {
//alert(i);
$('#slide-pager_next').click();
}
}
else {
//alert('slide left');
if (id >= 1) {
//alert(i);
$('#slide-pager_prev').click();
return false;
}
}
}
});
};
function onBefore() {
//e.preventDefault(); // same thing as above
$(".chapter-content .slideshow").fadeOut("fast");
// return false; // prevent default click action from happening!
}
function onAfter() {
// return false; // prevent default click action from happening!
//e.preventDefault(); // same thing as above
$(".chapter-content .slideshow").fadeIn("100");
// return false; // prevent default click action from happening!
}
答案 0 :(得分:0)
我看不到我们的演示,我可能会误解,但试试这个:
function onBefore() {
if ( !$('.slideshow').is(':animated') ) {
$(".chapter-content .slideshow").fadeOut("fast");
}
}
function onAfter() {
if ( !$('.slideshow').is(':animated') ) {
$(".chapter-content .slideshow").fadeIn("100");
}
}