Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count table cells in a row with JQuery?

Tags:

I have an image gallery with say 39 number of images. Two buttons prev and next and in the middle a counter. Images are inside a table and 6 of images are shown.
When the user presses next button 6 visible images go up and 6 others show.
I want to count number of visible images.
Example 6/39 when next is pressed there should be 12/39. If I do +6 on every click sometimes the last tr has less than 6 images and when the counter goes +6 it surpasses the number of all images. So i need to now the index of current tr being showed. Then I need to count the td's of that tr and put this number in the counter and increment.