Adding JQuery Pre-Loader gif to a script/function
How do I add a pre-loder to this script? I already have the animated gif. When I say preloader, I mean the spinning gif.
$(function(){
// Set starting slide to 1
var startSlide = 1;
// Get slide number if it exists
if (window.location.hash) {
startSlide = window.location.hash.replace('#','');
}
// Initializ开发者_运维问答e Slides
$('#slides').slides({
preload: true,
crossfade: true,
effect: 'fade',
fadeEasing: "easeOutQuad",
fadeSpeed: 400,
play: 5000,
pause: 2500,
hoverPause: true,
// Get the starting slide
start: startSlide,
animationComplete: function(current){
// Set the slide number as a hash
window.location.hash = '#' + current;
}
});
});
Thanks for the knowledge!
Overmars
I don't what have you altered in your plugin. For an unchanged slidejs plugin to set the spinning gif you have to just specify the preloadImage
.
preloadImage (string)
Name and location of loading image for preloader.
Default path is "/img/loading.gif".
An example is
$('#slides').slides({
preload: true,
preloadImage: '/img/loading.gif',
play: 5000,
pause: 2500,
hoverPause: true
});
精彩评论