Reputation: 766
I'm using a Full-screen background jquery slider for a website, which is by default in Pause state.
I tried playing around with the jQuery but it didn't quite worked for me.
I also tried to use trigger method to override the current pause state by click the 'play' button after page load
$(window).bind("load", function() {
$('a#play, a.play').trigger('click');
});
but that didn't worked too...
I'm pasting the jQuery script below that possibly does the action
jQuery(document).ready(function($){
$('body').append('<span id="body_loader"></span>');
$('#body_loader').fadeIn();
//In our jQuery function, we will first cache some element and define some variables:
var $bg = $('#background'),
$bg_img = $bg.find('img'),
$bg_img_eq = $bg_img.eq(0),
total = $bg_img.length,
current = 0,
$next = $('#next'),
$prev = $('#prev')
$(window).load(function(){
//hide loader
$('#body_loader').fadeOut('fast', function(){
init();
}).remove();
});
var intervalID,
play = $('#play'),
titleItem = $('.title-item');
//shows the first image and initializes events
function init(){
//get dimentions for the image, based on the windows size
var dim = getImageDim($bg_img_eq);
//set the returned values and show the image
$bg_img_eq.css({
width : dim.width,
height : dim.height,
left : dim.left,
top : dim.top
}).fadeIn('normal');
//resizing the window resizes the $tf_bg_img
$(window).bind('resize',function(){
var dim = getImageDim($bg_img_eq);
$bg_img_eq.css({
width : dim.width,
height : dim.height,
left : dim.left,
top : dim.top
});
});
var activeTitle = $bg_img_eq.attr('title');
titleItem.html(activeTitle);
titleItem.html(function(){
var text= $(this).text().split(" ");
var last = text.pop();
return text.join(" ")+ (text.length > 0 ? " <span class='word-last'>"+ last + "</span>" : last);
});
play.bind('click', function() {
if($(this).hasClass('pause')) {
clearInterval(intervalID);
$(this).removeClass('pause').addClass('play');
} else {
$(this).addClass('pause').removeClass('play');
intervalID = setInterval("$('#next').trigger('click')", 10000);
}
});
//click the arrow down, scrolls down
$next.bind('click',function(){
if($bg_img_eq.is(':animated'))
return false;
scroll('tb');
});
//click the arrow up, scrolls up
$prev.bind('click',function(){
if($bg_img_eq.is(':animated'))
return false;
scroll('bt');
});
}
The class & id of div which holds the images is background
and play button class and id is play
.
The link of the template that i'm working on http://xhtml.webtemplatemasters.com/style/dark/index.html#
Upvotes: 0
Views: 2849
Reputation: 766
Add this in your general.js file
play.trigger('click');
And if it's Wordpress Template, then
if(slide_autostart){
play.trigger('click');
}
Upvotes: 1
Reputation: 937
As an alternative you can also use this plugin.
http://buildinternet.com/project/supersized/
Upvotes: 2