PDA

View Full Version : Ajax Pagination Script small adjustment issue



pink-sheep
09-23-2007, 12:10 AM
1) Script Title:
Ajax Pagination Script

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

I'm trying to place the "next" button near the "previous" button, before the numeral pagination links, instead of its current location to the right. But unfortunately and surprisingly for me, moving the javascript line that writes HTML output for the "next" button immediately after the "previous", doesn't work. I mean, it works fine, the button gets placed correctly, it just doesn't work any more :(
I am moving this line

paginateHTML+='<li><a href="#next" rel="'+(selectedpage+1)+'">next </a></li>\n'

immediately after this one

paginateHTML+='<li><a href="#previous" rel="'+(selectedpage-1)+'"></a></li>\n'

Uhm.. help?:confused:

ddadmin
09-23-2007, 06:40 AM
The script assumes the "next" link is the last link within the pagination links. If you wish to move it so it's next to the "Prev" link (or 2nd place), you need to make the following two changes:

1) Modify the HTML so the "next" button is physically moved:


paginateHTML+='<li><a href="#previous" rel="'+(selectedpage-1)+'"> Prev</a></li>\n<li><a href="#next" rel="'+(selectedpage+1)+'">next </a></li>\n'

2), Then, modify the below lines within the script with the changes in red:


var prevlinkoffset=2
paginatelinks[1].className=(selectedpage==this.pageinfo.page.length-1)? "prevnext disabled" : "prevnext"
paginatelinks[1].setAttribute("rel", selectedpage+1)

Attached is the final modified ajaxpagination.js file.