Results 1 to 2 of 2

Thread: Simple Controls Gallery - stop loop

  1. #1
    Join Date
    Jan 2009
    Location
    Salt Lake City
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple Controls Gallery - stop loop

    Simple Controls Gallery

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

    Hey,

    I'd like the slideshow to stop looping after playing through once. Haven't had any successful attempts at creating a loop: false setting. Any suggestions?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    There are a few ways to do this. One of them that doesn't modify the .js file in any way is to use the onslide() event handler of the script like so:

    Code:
    var mygallery=new simpleGallery({
    	wrapperid: "simplegallery1", //ID of main gallery container,
    	dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
    	imagearray: [
    		["http://i26.tinypic.com/11l7ls0.jpg", "http://en.wikipedia.org/wiki/Swimming_pool", "_new"],
    		["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", ""],
    		["http://i30.tinypic.com/531q3n.jpg", "", ""],
    		["http://i31.tinypic.com/119w28m.jpg", "", ""]
    	],
    	autoplay: true,
    	persist: false,
    	pause: 2500, //pause between slides (milliseconds)
    	fadeduration: 500, //transition duration (milliseconds)
    	oninit:function(){ //event that fires when gallery has initialized/ ready to run
    	},
    	onslide:function(curslide, i){ //event that fires after each slide is shown
    		//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
    		//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
    	 if (i==3)
    			mygallery.navigate("playpause")
    	}
    })
    Here I'm assuming:

    1) The 4th slide is the last slide within your gallery (i==3). Remember, i starts at 0.

    2) That you have persist: false in the above. Otherwise, the last slide won't always be the 4th slide due to persistence of the last viewed slide.

    3) mygallery.navigate("playpause") should correspond to the this gallery instance's name.
    DD Admin

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
  •