Results 1 to 5 of 5

Thread: controls for the Featured Content Glider outside the toggler DIV

  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default controls for the Featured Content Glider outside the toggler DIV

    1) Script Title: Featured Content Glider

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

    3) Describe problem: The script functions as it should, but I am seeking the ability to load a slide (and stop rotation) through a link not in the pagination links. You can do this in the Featured Content Slider, but not on this script. I'd rather not switch over to the FCSlider; in fact, I have gotten a slide to load from an external link elsewhere on the page (outside the toggler DIV) but the rotation won't stop. If anyone can dive into the .js and help me define a function similar to
    <a href="javascript:fcs.jumpTo('home',3);"> like the FCSlider has, I would greatly appreciate it!

  2. #2
    Join Date
    Aug 2004
    Posts
    9,897
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    You can create your own "jump to" function for this script relatively easily. Firstly, you need to make a small change to your initialization code so the options object passed into the init() function is saved as a variable first, for example:

    Code:
    var gliderconfig={
    	gliderid: "canadaprovinces", //ID of main glider container
    	contentclass: "glidecontent", //Shared CSS class name of each glider content
    	togglerid: "p-select", //ID of toggler container
    	remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
    	selected: 0, //Default selected content index (0=1st)
    	persiststate: false, //Remember last content shown within browser session (true/false)?
    	speed: 500, //Glide animation duration (in milliseconds)
    	direction: "downup", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
    	autorotate: true, //Auto rotate contents (true/false)?
    	autorotateconfig: [3000, 2] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
    }
    
    featuredcontentglider.init(gliderconfig)
    In other words, first assign the config object to an arbitrary variable, then pass that variable into the init() function, instead of the way method of just directly passing this object into the function.

    With that done, add the below function following the above:

    Code:
    function gotoslide(config, pagenum){
    	featuredcontentglider.glide(config, pagenum)
    	featuredcontentglider.cancelautorotate(config.togglerid)
    }
    Then, to get the glider to go to a specific slide via regular links, do something like:

    Code:
    <a href="javascript:gotoslide(gliderconfig, 0)">Page 1</a> <a href="javascript:gotoslide(gliderconfig, 1)">Page 2</a>
    You'd call gotoslide(gliderconfig, 0) with the first parameter being the variable containing the config object for the glider in question, and the 2nd parameter a number corresponding to the page you wish to load (0=1st page etc).
    DD Admin

  3. #3
    Join Date
    Feb 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Object does not support this property or method. Throws a Javascript error.

    I wrote a function that actually jumps to the item in question but it will not stop the autorotate. In short, this is the essential part of what I've done ...

    <script type="text/javascript">
    var glidercon={
    id: "home"
    ...
    other parameters for featuredcontentglider
    ...
    }

    featuredcontentglider.init(glidercon)
    </script>

    Then my links look like
    <a href="javascript:fcs.jumpTo('home',0);">First frame</a>

    That will get me to my frame but won't stop the rotation. When I put the exact coding in that you gave me, nothing worked at all.

  4. #4
    Join Date
    Aug 2004
    Posts
    9,897
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    It should, I tested it and it works for me at least. Please post a link to the page on your site that contains the problematic script with the changes so we can check it out.
    DD Admin

  5. #5
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,
    I also had the same question the answer was a big help.
    It works perfectly for Firefox and IE 9, but unfortunately it does not work in IE6 and IE 8

    With "var = {glidercon" I got an error message (identifier expected ).
    Changed to "var: = {glidercon" it works for FF and IE9.
    But's not accepted by IE6 / IE8. Furthermore, the message: "identifier expected".

    Do you have an solution
    Regards, juppkk

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
  •