我的网站正在使用带有随机动画的nivo滑块,但我不知道如何调用一种类型的动画。这是我的js:
if (settings.effect === 'random') {
anims = new Array('sliceDownRight', 'sliceDownLeft', 'sliceUpRight', 'sliceUpLeft', 'sliceUpDown',
'sliceUpDownLeft', 'fold', 'fade', 'boxRandom', 'boxRain', 'boxRainReverse', 'boxRainGrowReverse', 'boxRainGrow');
currentEffect = anims[Math.floor(Math.random() * (anims.length + 1))];
if (currentEffect === undefined) {
currentEffect = 'fade';
}
}
// Run random effect from specified set (eg: effect:'fold,fade')
if (settings.effect.indexOf(',') !== -1) {
anims = settings.effect.split(',');
currentEffect = anims[Math.floor(Math.random() * (anims.length))];
if (currentEffect === undefined) {
currentEffect = 'fade';
}
}
// Custom transition as defined by "data-transition" attribute
if (vars.currentImage.attr('data-transition')) {
currentEffect = vars.currentImage.attr('data-transition');
}
// Run effects
vars.running = true;
var timeBuff = 0,
i = 0,
slices = '',
firstSlice = '',
totalBoxes = '',
boxes = '';
if (currentEffect === 'sliceDown' || currentEffect === 'sliceDownRight' || currentEffect === 'sliceDownLeft') {
createSlices(slider, settings, vars);
timeBuff = 0;
i = 0;
slices = $('.nivo-slice', slider);
if (currentEffect === 'sliceDownLeft') {
slices = $('.nivo-slice', slider)._reverse();
}
slices.each(function() {
var slice = $(this);
slice.css({
'top': '0px'
});
if (i === settings.slices - 1) {
setTimeout(function() {
slice.animate({
opacity: '1.0'
}, settings.animSpeed, '', function() {
slider.trigger('nivo:animFinished');
});
}, (100 + timeBuff));
} else {
setTimeout(function() {
slice.animate({
opacity: '1.0'
}, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
}
有人可以帮我解决这个问题吗?