1

不知道为什么,但每当我添加箭头部分时,我的选项都会被覆盖。在 jquery 和 javascript 方面不是最好的,所以如果你们可以帮助指出我没有看到的内容。我尝试在第二部分中添加选项,但什么也没有。

$=jQuery;   
$('.slider').unslider({
speed: 500,               //  The speed to animate each slide (in milliseconds)
delay: 33000,              //  The delay between slide animations (in milliseconds)
complete: function() {},  //  A function that gets called after every slide animation
keys: false,               //  Enable keyboard (left, right) arrow shortcuts
dots: true,               //  Display dot navigation
fluid: false              //  Support responsive design. May break non-responsive
});
// This overrides my options above.
var unslider = $('.slider').unslider();
$('.unslider-arrow').click(function() {
    var fn = this.className.split(' ')[1];
    //  Either do unslider.data('unslider').next() or .prev() depending on the className
    unslider.data('unslider')[fn]();

});
4

1 回答 1

2

我不确定是否理解,但我认为它会起作用

$(document).ready(function(){
    var unslider = $('.slider').unslider({
    speed: 500,               //  The speed to animate each slide (in milliseconds)
    delay: 33000,              //  The delay between slide animations (in milliseconds)
    complete: function() {},  //  A function that gets called after every slide animation
    keys: false,               //  Enable keyboard (left, right) arrow shortcuts
    dots: true,               //  Display dot navigation
    fluid: false              //  Support responsive design. May break non-responsive
    });
    $('.unslider-arrow').click(function() {
        var fn = this.className.split(' ')[1];
        //  Either do unslider.data('unslider').next() or .prev() depending on the className
        unslider.data('unslider')[fn]();

    });
});
于 2013-08-10T18:54:29.900 回答