Results 1 to 9 of 9

Thread: Delay the javascript function

  1. #1
    Join Date
    Jan 2013
    Location
    Praha
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Delay the javascript function

    Hi,
    I'd like to simply delay for 1 minute a JS function to execute. I have tried many times but no success, I am not good yet in syntax.
    The function is a Fade-in image slideshow which works itself very well, the manual comes from here>

    http://www.dynamicdrive.com/dynamici...nslideshow.htm

    (external files for js>
    http://www.dynamicdrive.com/dynamici...deslideshow.js
    http://ajax.googleapis.com/ajax/libs.../jquery.min.js)

    If someone just picks the piece of code and insert the delay function properly.) Thanks!

    The page draft source>
    http://www.pavelmartinek.com/2/index.html
    http://www.pavelmartinek.com/2/styles/fadeslideshow.js
    http://www.pavelmartinek.com/2/styles/screen.css
    Last edited by drmutant2; 01-03-2013 at 09:59 AM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    You're going to need to provide a little bit more information. What about the slideshow do you want to delay? Or is this on a whole different issue?

    Usually, without knowing specifically what you want, you'd use a timeout.

    Code:
    setTimeout(function() {
        
        foo();
        
    }, 1000 * 60); //1000 milliseconds/second * 60 seconds/minute

  3. #3
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    612
    Thanks
    46
    Thanked 32 Times in 32 Posts

    Default

    Please post a link to the problem page.
    Thanks,

    Bud

  4. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Nile View Post
    Usually, without knowing specifically what you want, you'd use a timeout.
    Or, you could use .delay()
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  5. #5
    Join Date
    Jan 2013
    Location
    Praha
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ajfmrf View Post
    Please post a link to the problem page.
    The page draft is here..
    http://pavelmartinek.com/2/index.html
    http://pavelmartinek.com/2/styles/screen.css
    http://pavelmartinek.com/2/styles/fadeslideshow.js

    I simply want to delay the "fadeslideshow" function for 1 minute.

  6. #6
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Only thing I can really think to do is make this modification to the script:
    Code:
    $.holdReady(true);
    setTimeout(function() {
          $.holdReady(false);
    }, 60000);
    This should stop it working for 1 minute.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  7. #7
    Join Date
    Jan 2013
    Location
    Praha
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks but it doesn't work./

    Put in fadeslideshow.js:
    Code:
    $.holdReady(true);
    setTimeout(function() {
          $.holdReady(false);
    }, 60000);
    
    var fadeSlideShow_descpanel={
    	controls: [['x.png',7,7], ['restore.png',10,11], ['loading.gif',54,55]], //full URL and dimensions of close, restore, and loading images
    	fontStyle: 'normal 11px Verdana', //font style for text descriptions
    	slidespeed: 200 //speed of description panel animation (in millisec)
    }
    
    jQuery.noConflict()
    
    function fadeSlideShow(settingarg){
    
    ..........etc.
    This doesn't work either:
    Code:
    setTimeout(function() {
        
        foo();
        
    }, 1000 * 60); //1000 milliseconds/second * 60 seconds/minute
    
    var fadeSlideShow_descpanel={
    	controls: [['x.png',7,7], ['restore.png',10,11], ['loading.gif',54,55]], //full URL and dimensions of close, restore, and loading images
    	fontStyle: 'normal 11px Verdana', //font style for text descriptions
    	slidespeed: 200 //speed of description panel animation (in millisec)
    }
    
    jQuery.noConflict()
    
    function fadeSlideShow(settingarg){
    
    ..........etc.
    One more thing, during the delay period I'd like to have a background image in a browser which what I've found can't be managed by html.
    #page {width:100%; height:100%; background-repeat: no-repeat; background-image: url(../img/1280-1024.jpg);}

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You want to delay the start of the slideshow for 1 minute? If so, on the page replace:

    Code:
    <script type="text/javascript">
    var mygallery=new fadeSlideShow({
    	wrapperid: "fadeshow1",
    	dimensions: [1280, 1024],
    	imagearray: [
    		["img/1.jpg"],
    		["img/2.jpg"],
    		["img/3.jpg"],		
    	],
    	displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
    	persist: false, 
    	fadeduration: 500, 
    	descreveal: "ondemand",
    	togglerid: ""
    })
    </script>
    with:

    Code:
    <script type="text/javascript">
    setTimeout(function(){
    	var mygallery=new fadeSlideShow({
    		wrapperid: "fadeshow1",
    		dimensions: [1280, 1024],
    		imagearray: [
    			["img/1.jpg"],
    			["img/2.jpg"],
    			["img/3.jpg"],		
    		],
    		displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
    		persist: false, 
    		fadeduration: 500, 
    		descreveal: "ondemand",
    		togglerid: ""
    	});
    }, 60000);
    </script>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. The Following User Says Thank You to jscheuer1 For This Useful Post:

    drmutant2 (01-05-2013)

  10. #9
    Join Date
    Jan 2013
    Location
    Praha
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    It works now! Thank you!

Similar Threads

  1. Featured Content Slider v2.4 - delay mouseover function
    By northshore in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 04-13-2012, 12:45 PM
  2. Javascript code to create a delay on Mousover
    By barryevans in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 11-17-2010, 01:35 AM
  3. Adding javascript function within ontoggle function
    By piers in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 07-22-2009, 02:41 AM
  4. Replies: 9
    Last Post: 09-16-2008, 05:31 PM
  5. Sucker tree menu delay in the javascript
    By missy11 in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 04-15-2008, 02:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •