Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How can I make a JQuery slideshow NOT START on load?
Old 07-07-2010, 01:49 AM How can I make a JQuery slideshow NOT START on load?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
I am using the following slideshow, which starts on load.

Code:
<script type="text/javascript" src="js/jquery.cycle.all.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#displayscreen').cycle({
      fx:'fade',
      timeout: 4500,
      speed:   1000,
      delay: 1000,
//pager set-up here
      next: '#next',
      prev: '#prev'
      });
      
      $('#playControl').toggle(
    function() {
    $('#displayscreen').cycle('pause');
    $(this).html('<img src="graphic_files/Turn_On_Slideshow.gif">');
    },
    function() {
    $('#displayscreen').cycle('resume');
    $(this).html('<img src="graphic_files/Turn_Off_Slideshow.gif">');
    });
    
      
}); // end ready()
</script>
How can I make it NOT START ON LOAD?

Many professionals like art buyers do not want a slideshow to start automatically. They'd rather click through the images. I want to keep the slideshow as an option.

Do I have to replace the .ready? With what?

Thanks.
World is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-07-2010, 02:05 AM Re: How can I make a JQuery slideshow NOT START on load?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
(deleted)

Last edited by World; 07-07-2010 at 02:39 AM..
World is offline
Reply With Quote
View Public Profile
 
Old 07-07-2010, 08:55 AM Re: How can I make a JQuery slideshow NOT START on load?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
read the documentation, there's an 'auto' option or something like that.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-07-2010, 05:22 PM Re: How can I make a JQuery slideshow NOT START on load?
Junior Talker

Posts: 2
Name: Marteen
Trades: 0
The $(document).ready mechanism is meant to fire after the DOM has been loaded successfully but makes no guarantees as to the state of the images referenced by the page. When in doubt, fall back on the good ol' window.onload event:
window.onload = function()
{
//your code here
};
Now, this is obviously slower than the jQuery approach. However, you can compromise somewhere in between:
$(document).ready
(
function()
{
var img = document.getElementById("myImage");

var intervalId = setInterval(
function()
{
if(img.complete)
{
clearInterval(intervalId);
//now we can start rotating the header
}
},
50);
}
);

Last edited by wayfarer07; 07-07-2010 at 07:54 PM.. Reason: fake signature removed
marteen456 is offline
Reply With Quote
View Public Profile
 
Old 07-08-2010, 01:43 AM Re: How can I make a JQuery slideshow NOT START on load?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
Thanks, marteen.

But if I'm not mistaken, using the window.onload event would equally trigger the slideshow to start automatically.

Which I want to prevent.

I want to give visitors a choice if they want the slideshow, or not.

I'm also not familiar with Javascript coding. I'm just putting some jquery elements together and am just able to do little changes e.g. adding preload.

I tried to replace document.ready with document.click.

Slideshow didn't start, but when I clicked the next button (which should only show the next image), the click triggered the slideshow to start.

What I'd need is an event that only starts the slideshow when I click a certain button.

Last edited by World; 07-08-2010 at 01:44 AM..
World is offline
Reply With Quote
View Public Profile
 
Old 07-08-2010, 07:27 AM Re: How can I make a JQuery slideshow NOT START on load?
Extreme Talker

Posts: 246
Trades: 0
I'm just going to put this out there but, why not have it play onclick of some element:

$('someButtonId').click(function(){
$('#displayscreen').cycle({
fx:'fade',
timeout: 4500,
speed: 1000,
delay: 1000,
//pager set-up here
next: '#next',
prev: '#prev'
});
});

Or have the slideshow paused right away:

$('#displayscreen').cycle('pause');
$(this).html('<img src="graphic_files/Turn_On_Slideshow.gif">');
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 07-08-2010, 08:26 AM Re: How can I make a JQuery slideshow NOT START on load?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
or, you could READ THE DOCUMENTATION, like I said the first time. It took me 10 seconds to find the option:

Code:
{
    timeout: 0
}
Which has the same effect as manual slideshow. In all fairness, I've used this plugin dozens of times, so I knew it was capable of this.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-09-2010, 12:18 AM Re: How can I make a JQuery slideshow NOT START on load?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
Quote:
Originally Posted by stbuchok View Post
I'm just going to put this out there but, why not have it play onclick of some element:

$('someButtonId').click(function(){
$('#displayscreen').cycle({
fx:'fade',
timeout: 4500,
speed: 1000,
delay: 1000,
//pager set-up here
next: '#next',
prev: '#prev'
});
});

Or have the slideshow paused right away:

$('#displayscreen').cycle('pause');
$(this).html('<img src="graphic_files/Turn_On_Slideshow.gif">');
Thanks for giving me code to play with. Very helpful. I look forward to trying this out.
World is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 12:21 AM Re: How can I make a JQuery slideshow NOT START on load?
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
Quote:
Originally Posted by wayfarer07 View Post
or, you could READ THE DOCUMENTATION, like I said the first time. It took me 10 seconds to find the option:

Code:
{
    timeout: 0
}
Which has the same effect as manual slideshow. In all fairness, I've used this plugin dozens of times, so I knew it was capable of this.
Did you mean the documentation of the cycle slideshow or the documentation of JQuery?

Jquery documentations are usually not informative for non-programmers (which I am, even though I am doing my best with the basic Javascript/JQuery I learned from the Missing Manual book).

But thanks for the timeout:0 tip!
World is offline
Reply With Quote
View Public Profile
 
Old 07-10-2010, 09:47 AM Re: How can I make a JQuery slideshow NOT START on load?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Quote:
Originally Posted by World View Post
Did you mean the documentation of the cycle slideshow or the documentation of JQuery?
documentation of the cycle slideshow
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to How can I make a JQuery slideshow NOT START on load?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32570 seconds with 12 queries