Counting divs for pagination in Jquery
- by Craig Ward
I want to create a nice pagination in Jquery for a number of divs I have. EG:
<div class="container">
<div id="one">content</div>
<div id="two">content</div>
<div id="three">content</div>
<div id="four">content</div>
</div>
The number will not always be the same so I need to count the divs, and display a pagination like the one below.
1|2|3|4
Clicking on the page number would display the relevant div. I know how to show and hide elements using Jquery and css and have figured out I can count the divs using var numPages = $('.container').size(); but I can't work out how I can display the pagination.
Any pointers?