Commits

Yorgos Pagles committed f365f99

* Hiccup on first page transition after introduction of the callback

Comments (0)

Files changed (1)

jquery.pajinate.js

 				e.preventDefault();
 				
 				movePageNumbersRight($(this),0);
-				goto(0);				
+				gotoPage(0);				
 			});			
 			
 			// Event handler for 'Last' link
 				e.preventDefault();
 				var lastPage = total_page_no_links - 1;
 				movePageNumbersLeft($(this),lastPage);
-				goto(lastPage);				
+				gotoPage(lastPage);				
 			});			
 			
 			// Event handler for 'Prev' link
 			// Event handler for each 'Page' link
 			$page_container.find('.page_link').click(function(e){
 				e.preventDefault();
-				goto($(this).attr('longdesc'));
+				gotoPage($(this).attr('longdesc'));
 			});			
 			
 			// Goto the required page
-			goto(parseInt(options.start_page));
+			gotoPage(parseInt(options.start_page), false);
 			toggleMoreLess();
 		});
 		
 			// Check that we aren't on a boundary link
 			if($(e).siblings('.active_page').prev('.page_link').length==true){
 				movePageNumbersRight(e,new_page);
-				goto(new_page);
+				gotoPage(new_page);
 			}
 				
 		};
 			// Check that we aren't on a boundary link
 			if($(e).siblings('.active_page').next('.page_link').length==true){		
 				movePageNumbersLeft(e,new_page);
-				goto(new_page);
+				gotoPage(new_page);
 			}
 				
 		};
 			
-		function goto(page_num){
+		function gotoPage(page_num, do_callback){
+			
+			 if (typeof do_callback === "undefined") {
+		        do_callback = true;
+		    }
 			
 			var ipp = meta.data(items_per_page);
 			
 			toggleMoreLess();
 			
 			// Call the callback function
-			if (typeof options.paging_callback === 'function'){
+			if (typeof options.paging_callback === 'function' && do_callback){
 				options.paging_callback();
 			}
 		};	
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.