You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
Using the following code triggers the onpage function-call twice when clicking a pagination link (workaround is included):
var page = 1; // global variable
$('.sbpagination').bootpag({
total: Math.ceil(numPosts / 50),
maxVisible: 3,
firstLastUse: true,
}).on("page", function(event, p){
// @xxx: bug in bootpag? - small workaround in order to avoid double requests and refresh-timeouts
if(page == p){
return;
}
page = p;
refreshShoutbox(((p-1)*50), 50); // $.post() is called inside this function which updates the content
});
The text was updated successfully, but these errors were encountered:
q4z1
changed the title
onpage function-call triggered twice
onpage function-call triggers twices
Jun 27, 2016
q4z1
changed the title
onpage function-call triggers twices
onpage function-call triggers twice
Jun 27, 2016
I ran into this as well. The strange thing is that the jquery trigger (line 173) is only called once (indicating to me, that -bootpag- is working correctly), but the number of calls to the callback bound to the 'page' event seems to be doubling every time a 'page' event is triggered. i.e. on the first page, 1 call, on the 2nd page 2 calls, on the 3rd page 4 calls..then 8 , 16 ,32 ,64 (calls of the callback function). Looking at the posts in the net window in firebug, it is always multiples of the same page number being requested, which is why q4z1's workaround works (immediate return from callback on duplicate page request). This seems like a bug in the jquery event code, not the bootpag code (as evidenced by only one call to 'page' trigger.) I tried adding an unbind() to the trigger line to see if old event bindings were the culprit, but no dice.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Using the following code triggers the onpage function-call twice when clicking a pagination link (workaround is included):
var page = 1; // global variable
$('.sbpagination').bootpag({
total: Math.ceil(numPosts / 50),
maxVisible: 3,
firstLastUse: true,
}).on("page", function(event, p){
// @xxx: bug in bootpag? - small workaround in order to avoid double requests and refresh-timeouts
if(page == p){
return;
}
page = p;
refreshShoutbox(((p-1)*50), 50); // $.post() is called inside this function which updates the content
});
The text was updated successfully, but these errors were encountered: