Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Featured Content Slider Linking Issue

  1. #1
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Featured Content Slider Linking Issue

    1) Script Title: Featured Content Slider

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

    3) Describe problem: Been working on implementing the "Featured Content Slider" and have run into an issue. Id like to create a link from within the content that would link to another one of the content slides. Tried different things but nothing seems to work. Anyone out there may have a suggestion?

    thanks in advance.
    JN
    Last edited by jnegron; 03-06-2008 at 06:25 PM.

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

    Default

    Sure, you can do so using the private function:

    Code:
    ContentSlider.turnpage('slider_id', pagenumber)
    Change "slider_id" to the ID of the Content Slider itself, and pagenumber, the page you wish to go to (0=page 1). For example:

    Code:
    <a href="javascript:ContentSlider.turnpage('slider1', 0)">Go to page 1</a>

  3. #3
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    you rock. thanks. worked perfectly.

  4. #4
    Join Date
    May 2008
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hello,

    This is exactly what I need, but I can't make it work. I get the Error: 'contentslider' is undefined.

    I have a contact form as one of the slides (slide 4), and I want to make the slider show this form when clicking on a link in slide 2. The slider-id is 'content':

    <a href="javascript:contentslider.turnpage('content', 3)">Contact Form</a>

    The main page (index.html), the content page (content.html) and the contentslider.js are separate files. The javascript file is referenced in the index.html only, and the contentslider.js is in a seperate 'js' folder.

    I've tried to reference the javascript in the content.html too, but this didn't help.

    Any idea what I'm doing wrong?

    Many thanks in advance.
    Petr

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

    Default

    Hi Petr:
    Please post a link to the page on your site that contains the problematic script so we can check it out.

  6. #6
    Join Date
    May 2008
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hello,
    here it is: http://www.mille-feuilles.ch/

    The link is in the section 'activités', the 11th bullet point from the top:
    Contact: Formulaire de contact"

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

    Default

    I see the problem. JavaScript is case sensitive, so you need to capitalize the "C" in your link:

    Code:
    <a href="javascript:Contentslider.turnpage('content', 3)">.....</a>

  8. #8
    Join Date
    May 2008
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I've tested your suggestion locally (I can't upload it from where I am right now) and the problem persists. My javascript filename is in lowercase "contentslider.js".
    I have referenced it like this in the index.html page:
    <script type="text/javascript" src="js/contentslider.js">

    In any case, somehow he isn't able to see the js file. Do I have to define the private function (or its location) somewhere ?

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

    Default

    Actually, this has nothing to do with the case sensitivity of the file "contentslider.js". Contentslider.turnpage() is the name of the method within this file that you're calling, which is case sensitive (ie: the "C" must be capitalized).

  10. #10
    Join Date
    May 2008
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I have checked how the .init method is called from the main page (featuredcontentslider.init) and I changed the call accordingly to:
    <a href="javascript:featuredcontentslider.turnpage('content', 3)">

    This time it seems that the method is found, but I get another error:
    "contentdivs.length is null or not an object", referring to this part of the script:

    var totalpages=setting.contentdivs.length
    var turntopage=(/prev/i.test(thepage))? currentpage-1 : (/next/i.test(thepage))? currentpage+1 : parseInt(thepage)
    turntopage=(turntopage<1)? totalpages : (turntopage>totalpages)? 1 : turntopage

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
  •