Created
February 5, 2014 17:12
-
-
Save mtheoryx/8828602 to your computer and use it in GitHub Desktop.
JS for conditional pagination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var stringTest = "Showing 1 to 4 of 10 entries"; | |
| stringTest = stringTest | |
| .replace('Showing', '') | |
| .replace('to ', '') | |
| .replace('of ', '') | |
| .replace('entries', '') | |
| .replace(" ", "") | |
| .trim(); | |
| stringTest = stringTest.split(" "); | |
| var container_end = stringTest[1]; | |
| var collection_end = stringTest[2]; | |
| console.log(container_end); | |
| console.log(collection_end); | |
| console.log(stringTest); | |
| // If our container_end is less than our collection_end | |
| // Then we need pagination, and we keep it | |
| // If not, just get rid of pagination altogether | |
| // Regardless, we get rid of the info anyway |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment