Results 1 to 7 of 7

Thread: How to stop the loop?

  1. #1
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default How to stop the loop?

    1) Script Title: Virtual Pagination script

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

    3) Describe problem:

    I'd like to stop the loop pagination when I get to the last page. Now, when you get to the last page of my virtual paginate, if you click "next" you'll get to the first page again. Is there any 'bug' to disable this re-start?

    Thanks,
    Rafa
    Last edited by ddadmin; 12-20-2007 at 01:10 AM.

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

    Default

    Try the below modified virtualpaginate.js file, which dynamically hides the "next" button if the user is currently on the last page.

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

    ata_gp (03-06-2008)

  4. #3
    Join Date
    Nov 2007
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    ddadmin, sorry to bother you...but is it possible to remove the "previous" link when you're on page 1?

    I tried to modify the code, but without any success.

    Thx in advance and merry christmas for you all.

    Edit:
    I just found these lines in the script:
    Code:
    if (this.previousbutton)
    this.previousbutton.style.visibility=(pagenumber==0)? "hidden" : "visible"
    It works great when you click on the link for page 1. But when you start the page it is visible. You have to click on number 1 to make it invisible. Any ideas how to auto hidden the previous button?

    Edit:
    One final question (1000 times sorry). Is it possible to change the script to show the pages like this:
    previous (when page > 1) | 1 2 3...9 10 11| next

    I mean the dots in this script. You see just the first 3 pages and the last 3 pages.

    Sorry for bothering you.
    Last edited by Moonwalker; 12-22-2007 at 07:53 PM.

  5. The Following User Says Thank You to Moonwalker For This Useful Post:

    ata_gp (03-06-2008)

  6. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    I found a way to hide the buttons by modifying the previous and next links by adding ids to these elements like so:

    Code:
    <a href="#" rel="previous" id="previous_page">Prev</a> <span class="flatview"></span> <a href="#" rel="next" id="next_page">Next</a>
    And also editting the javascript to make it hide if the page is page one or hide the next button if it is on the last page. It is attached below.

    Hope this helps.
    Last edited by thetestingsite; 12-22-2007 at 08:02 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  7. #5
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Using this code the pagination works fine, but I can't use external links like "mypage.html?page=1" or "mypage.html?page=2". With this new javascript i can't navigate using these commands. Is there any change in the virtualpaginate.js?

    Thanks



    Code:
    <a href="#" rel="previous" id="previous_page">Prev</a> <span class="flatview"></span> <a href="#" rel="next" id="next_page">Next</a>
    And also editting the javascript to make it hide if the page is page one or hide the next button if it is on the last page. It is attached below.

    Hope this helps.[/QUOTE]

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

    Default

    ata_gp, in the future, please start a new thread when asking your own question regarding a script. When you say:

    Using this code the pagination works fine, but I can't use external links like "mypage.html?page=1" or "mypage.html?page=2".
    Are you talking about using the URL to have a certain virtual page be selected by default when the page loads? Which thread on DD are you basing the technique using?

  9. The Following User Says Thank You to ddadmin For This Useful Post:

    ata_gp (03-06-2008)

  10. #7
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I'm sorry... I found in this forum an script that allows me going to a certain page using the following code: mypage.html?page=2.

    My apologize 'cos I don't find the post where I read it, but it was in this forum.

    The point is: If I use the new script to stop the loop my script doesn't work anymore.

    Thanks id advance

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
  •