Results 1 to 3 of 3

Thread: Possible to navigate to a specific slide?

  1. #1
    Join Date
    Aug 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Possible to navigate to a specific slide?

    1) Script Title: ParallaxSlider

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ider/index.htm

    3) Describe problem:

    By default this script allows navigation through back and forth links, but it does not appear to offer any way to link to a specific slide.

    This is what I have in my page:

    Code:
    <a href="javascript:firstparallaxslider.navigate('back')">Back</a> | <a href="javascript:firstparallaxslider.navigate('forth')">Forth</a>
    And here's the navigate function from parallaxslider.js

    Code:
    navigate:function(keyword){ //keyword: "back" or "forth"
    		var slideshow=this, setting=this.setting
    		clearTimeout(this.rotatetimer)
    		if (!setting.displaymode.stoponclick && setting.displaymode.type!="manual"){ //if slider should continue auto rotating after nav buttons are clicked on
    			this.curstep=(keyword=="back")? this.curstep-1 : this.curstep+1 //move curstep counter explicitly back or forth depending on direction of slide
    			this.rotatetimer=setTimeout(function(){slideshow.rotate()}, setting.displaymode.pause)
    		}
    		var dir=(keyword=="back")? (setting.orientation=="h"? "right" : "down") : (setting.orientation=="h"? "left" : "up")	
    		var targetslide=(keyword=="back")? this.curslide-1 : this.curslide+1
    		targetslide=(targetslide<0)? this.$imageslides.length-1 : (targetslide>this.$imageslides.length-1)? 0 : targetslide //wrap around
    		if (this.animation_isrunning==false)
    			this.slide(targetslide, dir)
    	},
    Would it be possible to add the ability to navigate directly to a slide by ID or something?

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    try

    Code:
    	navigate:function(keyword){ //keyword: "back" or "forth" or the slide number to goto
    		var slideshow=this,setting=this.setting, goto=this.$imageslides[keyword];
    		clearTimeout(this.rotatetimer)
    		if (!goto&&!setting.displaymode.stoponclick && setting.displaymode.type!="manual"){ //if slider should continue auto rotating after nav buttons are clicked on
    			this.curstep=(keyword=="back")? this.curstep-1 : this.curstep+1 //move curstep counter explicitly back or forth depending on direction of slide
    			this.rotatetimer=setTimeout(function(){slideshow.rotate()}, setting.displaymode.pause)
    		}
    		var dir=(keyword=="back"||(goto&&keyword<this.curslide))? (setting.orientation=="h"? "right" : "down") : (setting.orientation=="h"? "left" : "up")
    		var targetslide=(keyword=="back")? this.curslide-1 : this.curslide+1
    		targetslide=goto?keyword:(targetslide<0)? this.$imageslides.length-1 : (targetslide>this.$imageslides.length-1)? 0 : targetslide //wrap around
    		if (this.animation_isrunning==false)
    			this.slide(targetslide, dir)
    	},
    Code:
    <input type="button" name="" value="GoTo 2" onclick="firstparallaxslider.navigate(2)"/>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. The Following User Says Thank You to vwphillips For This Useful Post:

    slemhundy (08-07-2015)

  4. #3
    Join Date
    Aug 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up

    This is perfect. Thanks!

Similar Threads

  1. Content Glider link to specific slide
    By riprod in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-13-2011, 02:14 PM
  2. Ultimate Fade-in slideshow (v2.1) to show a specific slide
    By 3dudes in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 02-05-2010, 08:18 PM
  3. Link only specific images in Blending Slide Show
    By kdumas in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 11-15-2008, 06:36 PM
  4. Step Carousel Viewer - Jump to specific slide
    By bento in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 11-06-2008, 09:46 AM
  5. DHTML Slide Show in specific popups
    By martino in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 11-18-2005, 03:05 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
  •