Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination not working if not in active tab? #37

Open
robgnyc opened this issue Sep 16, 2014 · 3 comments
Open

Pagination not working if not in active tab? #37

robgnyc opened this issue Sep 16, 2014 · 3 comments

Comments

@robgnyc
Copy link

robgnyc commented Sep 16, 2014

Trying to use jPages on a page with standard bootstrap tabs. The pagination doesn't seem to work if it is located in one of the hidden tabs but does work if it's in the active tab.

Any reason this would be or fixes for it?

@hagar72
Copy link

hagar72 commented Nov 1, 2014

I'm having the same problem
this is because the plugin is working on the visible items only:
this._items = this._container.children(":visible");

@gfcodix
Copy link

gfcodix commented Feb 6, 2015

made it working with changing:

THIS: this._items = this._container.children(":visible");
INTO
THIS: this._items = this._container.children();

Though I think I might have affected other working things in the script it works for me in the tabs.

@katieschrader
Copy link

This solution doesn't involve altering the jPages plugin code. You can use the Bootstrap Events to trigger the pagination creation when the tab is shown.

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var pagerExist = $(" div.holder a").length
if (pagerExist == 0 ) {
$("div.pagination").jPages({
containerID: "itemContainer"
});
}
});

Bootstrap reference: http://getbootstrap.com/javascript/#tabs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants