Adding Auto Scroll to this jQuery slider?
Hello can anyone help?
I am using this full page slider..
http://www.musca.se/full-window-width-jquery-tools-content-slider-demo/
However i need to make it auto slide once the page loads, rather than just having the navigation.
This is the code that is used on the demo.
$(function() {
// Adds a class to the html code so we can target browsers without JS.
$('html').addClass('JS');
// Sets the slides width on page load
var i = $(window).width();
if (i > 904){ $('#items > li').css({ width: i }); }
// Scrollable and navigator plugin settings.
$("#slider").scrollable({ easing: 'easeOutQuad', speed: 904, circular: true }).navigator({ navi: '#navigation' });
// Window resize code
window.api = $("#slider").data("scrollable");
$(window).resize(function() {
var a = 1 + window.api.getIndex();
var w = $(window).width();
if (w > 904) {
var l = a * w开发者_如何学Go
$('#items').css({ left: + - +l });
$('#items > li').css({ width: w });
} else {
$('#items > li').css({ width: 904 });
}
});
});
Apparently adding this to it will ensure it auto slider...
$("#slider").scrollable({ circular: true }).autoscroll({ autoplay: true, autopause: false, interval: 2000 })
But i cannot figure out where it goes. :(
Can anyone who knows about these things help me out?
Many thanks for any help.
Add to ready event:
setInterval(function(){
$('#navigation-wrapper span.next').click()
},1000)
Change:
$("#slider").scrollable({ easing: 'easeOutQuad', speed: 904, circular: true }).navigator({ navi: '#navigation' });
to
$("#slider").scrollable({ easing: 'easeOutQuad', speed: 904, circular: true }).navigator({ navi: '#navigation' }).autoscroll({ autoplay: true, autopause: false, interval: 2000 });
I know I am late to the party, but maybe someone else find it useful.
精彩评论