Results 1 to 6 of 6

Thread: Featured content slider

  1. #1
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Featured content slider

    1) Script Title: Featured Content Slider v2.4

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

    3) Describe problem: I have a page where I want this slider. It works really great. The slider will get many pages, like 10+. The page is only 330 PX wide, so the pagination links gets to big when it shows all numbers. Is it possible to set it to show "[prev][4][5][6][7][8][next]" when you are on page 6, also it shows the page you are on in the middle, and the 2 previous and the 2 next?

    Btw, DynamicDrive is a great site! I like what you do and have find the most thing useful in my projects. If it doesen't exsist elsewhere, it exsist on dynamicdrive :P

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

    Default

    In theory you should be able to use the "onChange" event handler of the script to determine which index the user is currently at, then dynamically enable only the neighboring pagination links to show as well. First, you'd get a reference to all the pagination links, using something like:

    Code:
    var paginationlinks=document.getElementById("paginationdiv").getElementsByTagName("a")
    Then, inside the configuration code for Featured Content Slider, you may use the "onChange" event handler (see bottom of script page) in a manner such as:

    Code:
    onChange: function(previndex, curindex){
    for (var i=0; i<paginationlinks.length; i++){
     //enable previous and next 3 pagination links from current)
     paginationlinks[i].style.display=(i>=curindex-3 && i<=curindex+3)? "block" : "none"
    }
    }
    That's the theory anyhow.
    DD Admin

  3. #3
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    In theory you should be able to use the "onChange" event handler of the script to determine which index the user is currently at, then dynamically enable only the neighboring pagination links to show as well. First, you'd get a reference to all the pagination links, using something like:

    Code:
    var paginationlinks=document.getElementById("paginationdiv").getElementsByTagName("a")
    Then, inside the configuration code for Featured Content Slider, you may use the "onChange" event handler (see bottom of script page) in a manner such as:

    Code:
    onChange: function(previndex, curindex){
    for (var i=0; i<paginationlinks.length; i++){
     //enable previous and next 3 pagination links from current)
     paginationlinks[i].style.display=(i>=curindex-3 && i<=curindex+3)? "block" : "none"
    }
    }
    That's the theory anyhow.
    it still doesen't show it that way.

    Should I edit
    Code:
    var paginationlinks=document.getElementById("paginationdiv").getElementsByTagName("a")
    and where should I place it?

    Firebug says:
    document.getElementById("paginationdiv") is null
    file:///C:/Users/vigge_sWe/Desktop/tools/slider/contentslider.js
    Line 235
    paginationlinks is undefined
    file:///C:/Users/vigge_sWe/Desktop/tools/search1.html#7
    Line 88
    Last edited by vigge_sWe; 10-12-2008 at 08:23 AM.

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

    Default

    The code "var paginationlinks=document.getElementById("paginationdiv").getElementsByTagName("a")" was just a mockup. You would have to at least change "paginationdiv" to the ID of your pagination DIV. There may be additional changes required though based on how you've set up the script thus far. Please post a link to the page on your site that contains the problematic script so we can check it out.
    DD Admin

  5. #5
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    The code "var paginationlinks=document.getElementById("paginationdiv").getElementsByTagName("a")" was just a mockup. You would have to at least change "paginationdiv" to the ID of your pagination DIV. There may be additional changes required though based on how you've set up the script thus far. Please post a link to the page on your site that contains the problematic script so we can check it out.
    I set the script up exactly as it was on the page, the first example. The div is called paginate-slider1 I belive, is that right? Because when I try that, it wont work either

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

    Default

    If your actual pagination DIV is called "paginate-slider1", then it would need to be:

    Code:
    var paginationlinks=document.getElementById("paginate-slider1").getElementsByTagName("a")
    There are other details that need to be filled in as well, since as mentioned, what I posted was merely a blueprint. Please post a link to the page on your site that contains the problematic script so we can check it out.
    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
  •