jquery - Unslider arrow code overriding slider options -
not sure why whenever add arrows part options overridden. not best @ jquery , javascript if guys can point out not seeing. tried adding options in second part , nothing.
$=jquery; $('.slider').unslider({ speed: 500, // speed animate each slide (in milliseconds) delay: 33000, // delay between slide animations (in milliseconds) complete: function() {}, // function 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 }); // overrides options above. var unslider = $('.slider').unslider(); $('.unslider-arrow').click(function() { var fn = this.classname.split(' ')[1]; // either unslider.data('unslider').next() or .prev() depending on classname unslider.data('unslider')[fn](); });
i'm not sure understand but, think it'll work
$(document).ready(function(){ var unslider = $('.slider').unslider({ speed: 500, // speed animate each slide (in milliseconds) delay: 33000, // delay between slide animations (in milliseconds) complete: function() {}, // function 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 unslider.data('unslider').next() or .prev() depending on classname unslider.data('unslider')[fn](); }); });
Comments
Post a Comment