ajaxPager is a jQuery UI widget plugin for building javascript pagers quickly and easily. Each page’s content can be from either a ajax request, a url (iframe), string, element inside the pager, or element outside the pager.
If you are having problems with ajaxPager please report bugs or request support on the jQuery ajaxPager project page. Please make sure you include details on replicating the problem, including browser details, with a url to either an example or example code in paste bin or equivalent service.
People …
I’ve been so busy both at the University of Kent and with my freelance projects that unfortunately this site and my open source project ajaxPager have gone a little neglected. This evening I stole some time to add some of the projects I’ve been working.
Be sure to check them out …
Firstly an apology to the piss poor performance of my site recently, it was never great but recently its gone from bad to worse. Having done a little Googling around and testing I can only put this done to Media Temple’s Grid Server. I’ve just finished a year subscription …
Fixed a “pager.linksE is undefined” error, hopefully the same one people are reporting in the comments.
Current Features
- Content for a page can be:
- Response from an ajax request
- An entirely separate url (iframe)
- Static string
- HTML from a child of the pager holder
- HTML from an element in the page
- Ajax requests and preloading taken care of
- Page links generated, and abbreviated automatically
- API for changing and loading pages
- Animations in and out
- Position links above or below
- Add and remove pages methods
Todos
- Support all jQuery supported browsers
- Bring inline with jQuery guidelines
- Allow ajax link titles
- Omit noscript tags from inline defined pages
- allow pages to have a title so they can be referred to after they have been moved to an unknown position
Changelog
- 0.4.2 – 11th August 2009 – Fixed “pager.linksE is undefined” error
- 0.4.1 – 8th August 2009 – Fixed a couple of typos on lines 82 and 86 thanks to Tim Moss for spotting these
- 0.4.0 – 29th July 2009 – Supported browsers now include IE 6-8, Safari 4 and Firefox 3 (these I’ve test, there may be more compatible)
- 0.4.0 – 29th July 2009 – Added pager option to have page links above or below pager
- 0.4.0 – 29th July 2009 – Added page option to define link title
- 0.4.0 – 29th July 2009 – Added class to each page link, eg class=”page-1″
- 0.4.0 – 29th July 2009 – Where ever {i} could be used, {k} is also available and replace with page number as words
- 0.4.0 – 29th July 2009 – Added option to treat data after its loaded
- 0.4.0 – 29th July 2009 – Added option to preLoadPrevious pages
- 0.4.0 – 29th July 2009 – preLoad option can now be true
- 0.4.0 – 29th July 2009 – Added url cache feature: same urls for different pages will only be requested once
- 0.4.0 – 29th July 2009 – Added option useCache
- 0.4.0 – 29th July 2009 – Added animation options
- animationIn – animation to animate in
- animationOut – animation to animate out
- animationInDuration – time to take animating in
- animationOutDuration – time to take animating out
- animationInPrevious – animation to animate in when moving to a previous page
- animationOutPrevious – animation to animate out when moving to a previous page
- easingIn – easing to use in
- easyingOut – easing to use out
- fadeLoading – whether to fade the loading text out
- fadeLoadingDuration – time to take fading loading out and content in
- animations – array of animations, built in animations include:
- fade
- slide up
- slide down
- slide left
- slide right
- swipe up
- swipe down
- swipe left
- swipe right
direction indicates edge of origin for animate in and destination for out
- 0.3.0 – 12th July 2009 – Fixed a bug where pages defined as html inside the pager initially werent counted in the pagers numberofpages which cause a few problems including, next and last not dimming on last page and last link not linking to the last page
- 0.3.0 – 12th July 2009 – Added option to defined prefix and suffix for pagers and pages
- 0.3.0 – 12th July 2009 – Added option to defined loading text for pager and pages
- 0.3.0 – 12th July 2009 – Added linkOverflow option for pager to display consistent number of page links regardless of where you are in the page order
- 0.2.1 – 3rd July 2009 – Fixed a bug where end page links display one more than defined in options
- 0.2.1 – 3rd July 2009 – Fixed a bug where the page attempted to preload pages beyond the final page
- 0.2.0 – 3rd July 2009 – Added option to define page’s destroyOriginal option globally
- 0.2.0 – 3rd July 2009 – Added method to reload all pages
- 0.2.0 – 3rd July 2009 – Added method to reload individual and all pages when they are next requested
- 0.2.0 – 3rd July 2009 – Added method to load all pages
Requirements
For development I have been using jQuery 1.3.1 and jQuery UI 1.7.2 but it may well work with older versions, by all means try and let me know if you have any success.
Installation
Simply download and include the javascript file on your page after the jQuery and jQuery ui script tag. It should look something like.
<script src="/js/jquery-1.3.1.min.js" type="text/javascript"></script>
<script src="/js/ui.core.js" type="text/javascript"></script>
<script src="/js/jquery.ajaxPager.js" type="text/javascript"></script>
Initiation
The page is initiated by calling the ajaxPager function on a jQuery object.
$("#myPage").ajaxPager(options);
Pages are defined inside the options pages key (see below). They can also be defined inside the element that is being transformed into the pager. Any direct child with a class that matches the format pageX where X is a integer representing the element’s page number. Pages defined in this way are inserted into the pages defined in the pager’s options at position X.
Options
previous
- Type:
- boolean
- Default:
- true
Whether to display a link to the previous page in the page links.
- Initiate a pager that doesn’t display a previous link
$("#myPager").ajaxPager({previous: false})
previousText
- Type:
- string
- Default:
- <
The text to display inside the previous page link.
- Initiate a pager that has a previous link text Previous rather than <
$('#myPager').ajaxPager({previousText: "Previous"})
next
- Type:
- boolean
- Default:
- true
Whether to display a link to the next page in the page links.
- Initiate a pager that doesn’t display a next link
$('#myPager').ajaxPager({next: false})
nextText
- Type:
- string
- Default:
- >
The text to display inside the next page link.
- Initiate a pager that has a next link text Next rather than >
$('#myPager').ajaxPager({previousText: "Next"})
first
- Type:
- boolean
- Default:
- true
Whether to display a link to the first page in the page links.
- Initiate a pager that doesn’t display a first link
$('#myPager').ajaxPager({first: false})
firstText
- Type:
- string
- Default:
- |<
The text to display inside the first page link.
- Initiate a pager that has a first link text First rather than |<
$('#myPager').ajaxPager({firstText: "First"})
last
- Type:
- boolean
- Default:
- true
Whether to display a link to the last page in the page links.
- Initiate a pager that doesn’t display a last link
$('#myPager').ajaxPager({last: false})
lastText
- Type:
- string
- Default:
- >|
The text to display inside the last page link.
- Initiate a pager that has a last link text of “Last” rather than >|
$('#myPager').ajaxPager({lastText: "Last"})
linkPagesStart
- Type:
- integer
- Default:
- 2
The number of page links to display at the start of the list regardless of the current position.
- Initiate a pager with links to pages 1, 2, and 3 at the beginning of the page links regardless of the current page.
$('#myPager').ajaxPager({linkPagesStart: 3})
linkPagesBefore
- Type:
- integer
- Default:
- 5
The number of page links to display before the currently active page.
- Initiate a pager with links to each of the 10 pages before the current page.
$('#myPager').ajaxPager({linkPagesBefore: 10})
linkPagesAfter
- Type:
- integer
- Default:
- 5
The number of page links to display after the currently active page.
- Initiate a pager with links to each of the 10 pages after the current page.
$('#myPager').ajaxPager({linkPagesAfter: 10})
linkPagesEnd
- Type:
- integer
- Default:
- 2
The number of page links to display at the end of the list regardless of the current position.
- Initiate a pager with links to each of the final 3 pages at the end of the page links regardless of the current page.
$('#myPager').ajaxPager({linkPagesEnd: 3})
linkPagesBreak
- Type:
- string
- Default:
- …
The text to mark a break in the page links. Set to false to have unmarked breaks.
- Initiate a pager with no unmarked breaks.
$('#myPager').ajaxPager({linkPagesBreak: false})- Initiate a pager with breaks marked by the text “break”.
$('#myPager').ajaxPager({linkPagesBreak: "break"})
preLoad
- Type:
- boolean/int
- Default:
- 0
The number of pages to preload ahead of the current page. Setting to false will not preload any pages, true will preload them all. Using a boolean value is a global default and can be overridden in a page’s options.
- Initiate a pager where the next three pages are preLoaded.
$('#myPager').ajaxPager({preLoad:3})- Initiate a pager where the pages aren’t preloaded by default.
$('#myPager').ajaxPager({preLoad: false})
preLoadPrevious
- Type:
- int
- Default:
- 0
The number of pages to preload behid of the current page.
- Initiate a pager where the previous three pages are preLoaded.
$('#myPager').ajaxPager({preLoadPrevious:3})
page
- Type:
- integer
- Default:
- 1
The number of the initial page to load.
- Initiate a pager where the second page is shown.
$('#myPager').ajaxPager({page:2})
type
- Type:
- string
- Default:
- ajax
The default page type, valid values include:
- string: content is defined inside the page’s content option.
- ajax: content is loaded from an ajax request from the page’s url option.
- iframe: content is an iframe who’s src is the page’s url options.
- element: content is retrieved from the first element to match the page’s selector option.
- Initiate a pager where the default content type is string.
$('#myPager').ajaxPager({type:"string"})
selector
- Type:
- string
- Default:
- null
The default page selector, any instances of {i} in the selector will be replaced with the page number as digit eg “2″, any instances of {k} are replaced with the number as a word eg “two”. For pages of type element this will search the current pages for matches of this selector and use it’s contents. For pages of type ajax this will search the response for matches of this selector and use it’s contents.
- Initiate a pager where the default selector selects a element with an id of pageX where X is the page number.
$('#myPager').ajaxPager({type:"element",selector:"#page{i}"})
destroyOriginal
- Type:
- boolean
- Default:
- true
The default page option for destoryOriginal. For pages of type element this whether or not to destroy the element that the content was retrieved from.
- Initiate a pager where unless set in the page options, a page of type element will not remove the original element.
$('#myPager').ajaxPager({type:"element",selector:"#page{i}",destroyOriginal:false})
page
- Type:
- int
- Default:
- 1
The number of the initial page to load.
- Initiate a pager where the second page is shown.
$('#myPager').ajaxPager({page:2})
pagePrefix
- Type:
- string
- Default:
- null
A string to insert at the beginning of each page, {i} will be replaced with the page number as digit eg “2″, any instances of {k} are replaced with the number as a word eg “two”.
- Initiate a pager each page has a prefix of a title with the page’s number in.
$('#myPager').ajaxPager({pagePrefix:"<h3>Page {i}</h3>"})
pageSuffix
- Type:
- string
- Default:
- null
A string to insert at the end of each page, {i} will be replaced with the page number as digit eg “2″, any instances of {k} are replaced with the number as a word eg “two”.
- Initiate a pager each page has a suffix of a not with the page’s number in.
$('#myPager').ajaxPager({pageSuffix:"<p>That was page {i}.</p>"})
loadingText
- Type:
- string
- Default:
- Loading…
A string to insert into the page while it’s content is loading. {i} will be replaced by the page number as digit eg “2″, any instances of {k} are replaced with the number as a word eg “two”.
- Initiate a pager where each page displays Loading page x… while its loading.
$('#myPager').ajaxPager({loadingText:"<p>Loading page {i}...</p>"})
linkOverflow
- Type:
- boolean
- Default:
- true
Whether or not to use unused links from any of the sections (start, end, before, after) on the other side of current page. This leads to a consistent number of displayed page links despite where you are in the page order.
- Initiate a pager were as it gets to the end places from the linkPagesAfter that aren’t used are transfered to the linkPagesBefore.
$('#myPager').ajaxPager({linkOverflow:true, linkPagesAfter:5, linkPagesBefore:1})
linkPosition
- Type:
- string
- Default:
- below
Where to place the links in the order of the DOM, can be: ‘above’, ‘below’ or ‘both’.
- Initiate a pager where the page links are displayed before the pager.
$('#myPager').ajaxPager({linkPosition:'above'})
linkText
- Type:
- string
- Default:
- {i}
Text to use for links, {i} is replace by the page number as a digit eg “2″, {k} is replaced with the page number as a word eg “two”.
- Initiate a pager where the page links are displayed as Page X.
$('#myPager').ajaxPager({linkText:'Page {k}'})
treatData
- Type:
- function
- Default:
- null
Function to handle ajax data before it is used by the pager, the data is passed into the function in the first argument.
- Initiate a pager where ajax data is treated and bs are replaced with ds.
$('#myPager').ajaxPager({treatData:function (data) { return data.replace(/b/g,"d");}})
useCache
- Type:
- boolean
- Default:
- true
Whether or not to cache ajax responses.
- Initiate a pager where ajax request are rerequested each time.
$('#myPager').ajaxPager({useCache:false})
animation
- Type:
- boolean
- Default:
- true
Whether or not to animate page swaps. In order for the built in animations to work properly each page (div.ajaxPagerPage) and their animation handler (div.animationHandler) need to be positioned absolutely, have top, left, right, and bottom attributes set to 0px and have a fixed height and width. Built in animations include: fade, slide up, slide down, slide left, slide right, swipe up, swipe down, swipe left, swipe right. The direction (up, down, left, right) indicates the direction from when animating in and the direction to when animating out.
- Initiate a pager that does not animate on page swaps.
$('#myPager').ajaxPager({animation:false})
animationIn
- Type:
- string
- Default:
- slide left
How to animate pages in
- Initiate a pager where page fade in.
$('#myPager').ajaxPager({animationIn:'fade'})
animationOut
- Type:
- string
- Default:
- slide right
How to animate pages out
- Initiate a pager where pages fade out.
$('#myPager').ajaxPager({animationOut:'fade'})
animationInPrevious
- Type:
- string
- Default:
- slide right
How to animate pages in, when swapping to a previous page.
- Initiate a pager where page slide in from the left when choosing a previous page.
$('#myPager').ajaxPager({animationInPrevious:'slide left'})
animationOutPrevious
- Type:
- string
- Default:
- slide right
How to animate pages out, when swapping to a previous page.
- Initiate a pager where pages slide out to the right when choosing a previous page.
$('#myPager').ajaxPager({animationOutPrevoius:'slide right'})
animationInDuration
- Type:
- int
- Default:
- 300
How long to take animating pages in, value is in milliseconds.
- Initiate a pager where pages take 1 second to animate in.
$('#myPager').ajaxPager({animationInDuration:1000})
animationOverlap
- Type:
- boolean/int
- Default:
- true
Whether to overlap animations in and out. True runs both in and out animations at the same time, false will run the in animation once the out animation has finished. An integer value will run the in animation that long (in milliseconds) before the end of the out animation.
- Initiate a pager where animations don’t animate.
$('#myPager').ajaxPager({animationOverlap:false})
fadeLoading
- Type:
- boolean
- Default:
- true
Whether to fade loading text out, and content in once it has loaded.
- Initiate a pager where the loading text does not fade out.
$('#myPager').ajaxPager({fadeLoading:false})
fadeLoadingDuration
- Type:
- int
- Default:
- 300
Time taken (in milliseconds) to fade loading text out and fade content in.
- Initiate a pager where the loading text fades out in half a second and then content fades in in half a second.
$('#myPager').ajaxPager({fadeLoadingDuration:1000})
easingIn
- Type:
- string
- Default:
- swing
Easing to use when animating pages in, out of the box options with jQuery UI are linear and swing.
- Initiate a pager where the pages animating in use a linear easing.
$('#myPager').ajaxPager({easingIn:'linear'})
easingOut
- Type:
- string
- Default:
- swing
Easing to use when animating pages out, out of the box options with jQuery UI are linear and swing.
- Initiate a pager where the pages animating in use a linear easing.
$('#myPager').ajaxPager({easingOut:'linear'})
animationOutDuration
- Type:
- int
- Default:
- 300
How long to take animating pages out, value is in milliseconds.
- Initiate a pager where pages take 1 second to animate out.
$('#myPager').ajaxPager({animationOutDuration:1000})
animations
- Type:
- array
- Default:
- see below
An array of custom animations to use. Each animation is an object with the following nested objects ‘in’, ‘out’, ‘maskIn’, ‘maskOut’, which are a set of css properties and values. ‘in’ is the css when the page is showing and ‘out’ is the css when the page is not. ‘maskIn’ and ‘maskOut’ are applied to a wrapper div and are used for things like the swipe animations. Custom animations are merged with the build in ones. See the source file (jquery.ajaxpager.js) to see how the built in animations work, they can be found in the _animation property towards the end of the file.
pages
- Type:
- array
- Default:
- null
An array of page options objects that represents the pager’s pages. See page options for possible values.
- Initiate a pager with a page of each type.
$('#myPager').ajaxPager({pages:Array(
{
type: "ajax",
url: "/page1.html"
},
{
type: "iframe",
url: "/page2.html"
},
{
type: "element",
selector: "#page3",
},
{
type: "string",
content: "This is page 4",
}
)})
Page options
type
- Type:
- string
- Default:
- null
The type of page, see pager page types for possible values.
content
- Type:
- string
- Default:
- null
The content for pages of type string.
- Initiate a pager where the first page’s content is a static string.
$('#myPager').ajaxPager({
pages: Array(
{type:"string",content:"This is page 1"}
)
})
url
- Type:
- string
- Default:
- null
For pages of type ajax this is the location of the ajax request. For pages of type iframe this will be used for the iframe’s src.
- Initiate an pager with a ajax and iframe page from /page1.html and /page2.html respectively.
$('#myPager').ajaxPager({
pages: Array(
{type:"iframe",url:"/page1.html"},
{type:"ajax",url:"/page2.html"}
)
})
selector
- Type:
- string
- Default:
- null
For pages of type ajax the ajax response will be search for matches and the first match’s inner html will be used for the page’s content. For pages of type element the current document will be search for matches and the first’s inner html will be used for the page’s content.
- Initiate an pager with a ajax and element pages where the content is inside a div with class of pageX where X is the page number.
$('#myPager').ajaxPager({
pages: Array(
{type:"element",selector:"div.page1"},
{type:"ajax",url:"/pages.html",selector:"div.page2"}
)
})
destroyOriginal
- Type:
- boolean
- Default:
- true
For pages of type element whether or not to destroy the element that the content was retrieved from.
- Initiate an pager with a page that gets it content from an element inside the current document and keeps the original.
$('#myPager').ajaxPager({
pages: Array(
{type:"element",selector:"div.page1",destoryOriginal:false},
)
})
prefix
- Type:
- string
- Default:
- null
A string to insert at the beginning of the page, overrides the pagers pagePrefix option.
suffix
- Type:
- string
- Default:
- null
A string to insert at the end of the page, overrides the pagers pageSuffix option.
loadingText
- Type:
- string
- Default:
- Loading…
A string to insert in the page while it is still loading. Overrides the pagers loadingText option.
linkText
- Type:
- string
- Default:
- {i}
Text to use for the pages link, {i} is replace by the page number as a digit eg “2″, {k} is replaced with the page number as a word eg “two”.
treatData
- Type:
- function
- Default:
- function (data) {return data;}
Function to handle ajax data before it is used by the pager, the data is passed into the function in the first argument.
preLoad
- Type:
- boolean
- Default:
- false
Whether or not to preload this page before it is shown.
useCache
- Type:
- boolean
- Default:
- true
Whether or not to use the cached value for this page’s url.
animation
- Type:
- boolean
- Default:
- true
Whether or not to animate this page.
animationIn
- Type:
- string
- Default:
- slide left
How to animate this page in.
animationOut
- Type:
- string
- Default:
- slide right
How to animate this page out.
animationInPrevious
- Type:
- string
- Default:
- slide right
How to animate this page in when swapping to a previous page.
animationOutPrevious
- Type:
- string
- Default:
- slide right
How to animate this page out when swapping to a previous page.
animationInDuration
- Type:
- int
- Default:
- 300
How long this page should take animating in.
animationOverlap
- Type:
- boolean/int
- Default:
- true
Whether to overlap this pages in animation with the previous’ out. True runs both in and out animations at the same time, false will run the in animation once the out animation has finished. An integer value will run the in animation that long (in milliseconds) before the end of the out animation.
fadeLoading
- Type:
- boolean
- Default:
- true
Whether to fade this pages loading text out, and content in once it has loaded.
fadeLoadingDuration
- Type:
- int
- Default:
- 300
Time taken (in milliseconds) to fade this pages’ loading text out and fade content in.
easingIn
- Type:
- string
- Default:
- swing
Easing to use when animating this page in, out of the box options with jQuery UI are linear and swing.
easingOut
- Type:
- string
- Default:
- swing
Easing to use when animating this page out, out of the box options with jQuery UI are linear and swing.
animationOutDuration
- Type:
- int
- Default:
- 300
How long to take animating this page out, value is in milliseconds.
Events
onPageShow
- Type:
This event is trigged when a page is shown. i is the shown page.
- Initiate a pager that triggers an alert when a page is shown.
$('#myPager').ajaxPager({onPageShow:function(i) { alert("page "+i+" was shown" }})
onPageLoad
- Type:
This event is trigged when a page content’s is loaded, for pages other than type ajax and iframe this is when the pager is initiated. i is the loaded page.
- Initiate a pager that triggers an alert when a page is loaded.
$('#myPager').ajaxPager({onPageLoad:function(i) { alert("page "+i+" was loaded" }})
Page Events
onShow
- Type:
This event is trigged when a page is shown.
- Initiate a pager that triggers an alert when the first page is shown.
$('#myPager').ajaxPager({pages:array(
{type:"element",selector:"div.page1",onShow:function(){alert("showing page 1")}},
{type:"ajax",url:"/pages.html",selector:"div.page2"}
)})
onLoad
- Type:
This event is trigged when a page is loaded.
- Initiate a pager that triggers an alert when the first page is loaded.
$('#myPager').ajaxPager({pages:array(
{type:"element",selector:"div.page1",onLoad:function(){alert("showing page 1")}},
{type:"ajax",url:"/pages.html",selector:"div.page2"}
)})
Methods
setPage
- Arguments
-
- pageNumber
Sets the current page to pageNumber.
- Set a pager’s page to page 3.
$('#myPager').ajaxPager("setPage",3)
nextPage
- Set a pager’s page to the next one.
$('#myPager').ajaxPager("nextPage")
previousPage
- Set a pager’s page to the previous one.
$('#myPager').ajaxPager("previousPage")
lastPage
- Show the pager’s last page.
$('#myPager').ajaxPager("lastPage")
firstPage
- Show the pager’s first page.
$('#myPager').ajaxPager("firstPage")
loadPage
- Arguments
-
- pageNumber
Load a page if it’s not all ready been loaded.
- Load the pager’s forth page, without showing it.
$('#myPager').ajaxPager("loadPage",4)
reloadPage
- Arguments
-
- pageNumber
Reload a page even if it’s already been loaded.
- Reload the pager’s forth page, without showing it.
$('#myPager').ajaxPager("reloadPage",4)
reloadAll
- Reload all pages.
$('#myPager').ajaxPager("reloadAll")
loadAll
- Reload all pages.
$('#myPager').ajaxPager("reloadAll")
reloadPageOnDemand
- Arguments
-
- pageNumber
Reload a page when it is next requested.
- Reload page 3 when it is next clicked.
$('#myPager').ajaxPager("reloadPageOnDemand",3)
reloadAllOnDemand
- Reload all pages, when each is next requested.
$('#myPager').ajaxPager("reloadAllOnDemand")
addPage
- Add a new first page.
$('#myPager').ajaxPager("addPage",{pageNumber:1,type:'static',content:'New custom first page.'})
removePage
- Remove the first page.
$('#myPager').ajaxPager("removePage",1)
reloadAllOnDemand
- Reload all pages, when each is next requested.
$('#myPager').ajaxPager("reloadAllOnDemand")
Theming
I haven’t even thought about theming, so for the time being I suggest you just slap some css over the top. I may look into how theming for jQuery UI works at a later date.
Your browser does not support iframesĀ <a href=”http://demos.digitalintuition.co.uk/ajaxpager/index.html” mce_href=”http://demos.digitalintuition.co.uk/ajaxpager/index.html” target=”_blank”>view demo in a new window</a> It could also be because wordpress has stripped my iframe tags out again, which I can’t seem to find a solution for, click the link to check out the demo.

am not able to see the demo
Sorry console.log was causing problems. It Should be fixed now, it’s still not working in ie6 but that the next thing on the list of things to do.
Great plugin! I would like to use this a as wizard type application with each step in the wizard loading a page. Can I change the paging at the bottom to read say: step1 step2 etc. instead of just 1 2 3 etc.
Any help would be appreciated!!
Not at the minute
But I will add your feedback to the list of things to do
I am thinking the following should cover your needs
[...] need extra help please contact me) 0.4 is ready. There are quite a few new features, check out the change log for more details, but of significance [...]
Thanks for all your work on this, it’s awesome.
I’ve been asked to create a portfolio section in which the first page of this widget contains a grid of thumbnails from each page, and navigation would be either back and forth (between pages) or back to page 1 to choose from the grid again.
I’m going to do my best to modify it to do just that, my question is, is there any particular reason that would *not* work, i.e., break some basic functionality or go against some fundamental structure of the widget. I guess I just want to know it’s possible
Oh, and these things are all supposed to populate from expression engine gallery templates, but, that’s another story entirely
Awesome widget, though, just as-is.
I don’t see any reason why it shouldn’t
The easiest way to achieve it would be to create the first page’s thumbnails manually (or with php) and use the widget methods (firstPage, previousPage, nextPage etc) to give them behavior. Then either build your own page links using these same methods or use the built in links, with the options set to next=true, previous=true, linkPagesStart=1 (all other link options set to false or 0).
It would also be cool to see an option to allow an index page that is automatically built including thumbs (may be from a thumb option on each page for the url). If you do decide to go down this route let me know how you get on and I’ll see about integrating your changes in.
Ideally, I’ll be generating the thumbnails out of a category list which would be generated by Expression Engine. Might have to mix in a little PHP to get page numbers to tie to gallery names. Should be an interesting day, I’ll let you know how it comes out.
I also need to look into ways to direct link to a particular page in the gallery … but that’s frosting on the cake, first I need to get the basics running.
I am planning to add support for deep linking to pages
but a quick fix would be to link to a bookmark then once the pager has been initiated search for the bookmark in the url, from that determine what page you want and use the setPage method to set it
My first challenge has been getting things to work in the first place. Basically, just want it to run like the one in this page before I start getting fancy. Using the options listed above, it always returns “pager.linksE is undefined”. So looking at that function, I decided, maybe I don’t need it, so I commented out that whole thing, and the thing further on down that wants “this._refreshLinks” (since I don’t really need that either). At this point, my basic “next” and “previous” buttons directly using the methods work, but fail at the point I try to go -1 (of course, since that’s in the bit i commented out). And that was after I figured out I had to use iFrames, because the pages I’m referencing need to run their own scripts. d’oh!
I’m a long way from being even close to making this work, but, I haven’t given up. I’m a little brain-foggy from overworking lately, so I’m probably missing very obvious things.
Can you send me your source code, and what browser your using
I’m not actually using this in a real world project yet, and you are only one of two people I heard back from using this, so there is a good chance its a bug
The script that is on the jquery plugins site has a couple typos that cause it to not work completely. On lines 82 and 86, this.optionslinkPosition should be this.options.linkPosition
Thanks
Fixed in 0.4.1 – just uploaded to plugins.jquery.com
I too am seeing the “pager.linksE is undefined” error, with both the latest jQuery and jQuery UI installed.
I cannot provide soruce code since this is for $WORK. Sorry.
May I suggest QUnit or a similar product for unit testing?
I managed to replicate (fixed and updated on plugins.jquery,com) the pager.linksE is undefined error, by not displaying the pager links.
Hopefully this is the same error you guys are reporting, without your code I couldn’t be sure.
Please let me know if it’s still doing it.
Will check out your recommendation for unit testing but unfortunately things are a little hectic at work at the minute so don’t have much time for this. Will keep fixing bugs as they are reported though.
linkPosition:’both’ Not Work!!!
Can this plugin work with .aspx page when use ‘ajax’ type???
I don’t see why not, it doesn’t communicate with the server side script directly so it doesn’t matter what you use
Thanks for your answer, I’ve used this plugin with aspx page sccessfully now, this plugin is really helpful to me
.
But I have another little question about the css layout configuration, because the height of the content I get through ajax is dynamic, so sometimes the scroll bar will appear.
How can I make the top position of pager always be the bottom position of content, so the scroll bar will never appear??
I trying to get the current page number, and add a method as below:
getCurrentPageNumber: function () {
return this.currentPageNumber;
}
I expect to get a number, but it didn’t…why??
Hi, I’m trying to run some javascript on every page, loaded with ajaxPager, but I’m having some troubles.
In every page I put the code in $(document).ready, so when you load the first one – it works, the second and the other ones are also working, but… when you click the “prev” button – there’s nobody working there.
I’ve also tried to put the code in onPageShow, but it doesn’t work. Any ideas?
Hi!
I’am passing a global array of ajax-pageurl-requests to the initial call of ajaxPager. How can I trigger ajaxPager to re-read this array and start over? The content and number of pages might have changed.
The css isn’t really part of the widget just something I knocked up quickly for the demo
Not Sure quite what you mean, do you have a url I can have a look at it
you may have some luck (and when i say may i mean i’m pretty sure you wont) with $(’#myPager”).ajaxPager(”reloadAll”)
I will try and work this into the next release
‘reloadAll’ was my first try, but – you were right – no luck at all. Have to get a better dev.random…
Any ideas, plans? Days, weeks, months? I’d like to finish my stuff until the end of the month and if you are out of time and have better things to do, I’d rather look for another solution than wait. Allthough it would be a pitty.
Excuse my bad english – it may sound ruder than I mean it.
Hi,
I just found your lib which looks really good.
Following on tonto’s comment, I am also trying to use ajaxPager with other jQuery libs. Basically i have a menu on every page which uses lavalamp and another small script. When my page is initally loaded everything works. However when i click on a link in my menu (it correctly goes to another page), and come back, none of the scripts (lavalamp and my script) work anymore… It looks to me that the scripts are not reloaded…
Note that to do the page switch i use setPage.
Any ideas?
Thanks in advance
Manu
I’m affraid I’m pretty busy with other stuff at the moment, I have been meaning to have another sit down with it and hope to get another version out within a couple of weeks but can not promise anything
@manu do you have a url i can see what you are explaining
@tonto i havent done anywork with having multiple pagers on a single page, depending on how hard it is to implement I hope to fix this in the next release
I’m really sorry not much has happened release wise for a while, I’m just snowed under with work at the moment
Never mind, just knitted my own solution. Allthough it’s no plugin, it does the job.
Thanks for thinking about it anyway.
Sascha
I don’t have a URL yet, but here is a very simple example to illustrate what i mean. In this example the page 1 has 2 links, 1 that shows an alert bow when hovered, and one that links back to page 1.
To replicate the issue:
– open the page, hover on “go to page 2″ -> the alert box apears
– now click on “go home”
– now hover on “go to page 2″ -> the alert is not shown anymore…
Hopefully I am doing something incorrect…
Here is the code for the main page:
page2
function gotoPage(i)
{
$('#results').ajaxPager("setPage", i);
}
jQuery(function( $ ){
$('#results').ajaxPager({
pages: Array (
{
url: "ajax_test_pag.html",
selector: false,
type: "ajax",
onShow: function () {
console.log("showing page 1");
},
onLoad: function () {
console.log("page 1 loaded");
}
}
)
});
});
Here is the code for the page1:
goto page 2
go home
$("#press").hover(function() {
alert("hello");
});
function gotoPage(i)
{
$('#results').ajaxPager("setPage", i);
}
hmm my apologies, the code was not shown properly on your blog (i used the code tags)…
is there any way i can send it to you in a different way
Thanks
dont worry i can see the code properly in the admin area
will try and have a look at this over the weekend
Actually I do have a URL, where you are able to see the pagination working. On this site you can test it – elementary form submit with ajax, than in the main ajax I’ve placed the pagination (for the test I’m writing in the upper field something like “as” and just press enter). When the pages are loaded, I run a script which makes the green icons links for showing some information – you can test it on the first page from my example. Now it’s working, but not every time – and I can’t explain why. The script which makes the icons work is placed at the end of every page’s html in a setTimeout() function without second parameter.
P.S.: Matt, have you forgotten about the onShow functions? I’ve realized that they were not working and than I found some missing rows in your plugin. It’s not hard to copy-paste from the onLoad and just change some names.
I’m hardly trying to make the plugin running normal on my app and in case of success I’ll tell you and give you a link.
Hi Matt,
Did you have any time to spend trying to fix this issue?
I’m really sorry I didnt get a chance to look at these issues like I promised,
Work has been very stressful the last couple of weeks
I am hoping to fix these outstanding issues on Sunday
Please bare with me guys
There’s no problem, Matt, you’ve got the link up there, check it when you can
If you have a problem with the cyrillic symbols, just let me know.
In all your examples on the documentation tab, you’ve mixed single and double quotes together — see #’myPager”. No love when copying/pasting examples.
Hi,
I really like your plugin. I am having one issue. You can see my demo here:
http://www.sjlarchitect.com/help/projects_en1.html (only pager on tab 1 has content)
It works great moving forward through the pager, but if you navigate to previous pages it flashes the page below the current one, before it is loaded….
Do you have any suggestions? Please Help!!!!
I don“t know much for this plugin, can you post a puntual example, o dont have any idea how it works what i need in th e server sider a php file? for proveing data? thanks
regards
David
Luke, your link is not working…. Sorry for the late reaction, but the university is taking all of my time
lol
like the man said
ok so ajaxPager has gone a little neglected lately as have your comments
here are some personal replies
@David sorry what to you mean by a puntual example
@Luke would take another look but your link is a 404, but i have a feeling you can fix this by setting the height and using over: hidden
@kay thanks for pointing this out I’ve fixed these now, if you spot any more let me know
@tonto I’ve had a look at your example and its working fine for me, cool implementation btw
since starting this post i have learnt that a blog post is not a good way to track bugs so if you have bugs to report or need help implementing please log them on the jquery ajaxPager project page either with a url to an working example or example code on paste bin or equivalent service along with details on how to replicate your problem and in what browser the bug is happening
[...] a ajax request, a url (iframe), string, element inside the pager, or element outside the pager. Web Site Demo Download AKPC_IDS += "688,";Popularity: unranked [?] Share and [...]
hey…1st i should say thats awesome.
I’ve a lil prob.
I want use this in my website. Its a PHP site. So i want know where i insert the url to get the next and previous items.
ex:-
To get next item => http://www.mywebsite.com/action.php?type=next-item
To get previous item => http://www.mywebsite.com/action.php?type=previous-item
this pager isn’t designed to support server side paging like this