0

I'm using jQuery script from jQuery automatic heading numbering for H2 subtitle counting. I just updated the script little bit:

var h2Elements = $('article').find('h2');            
       var h2ElemCount = h2Elements.length;        
        $(h2Elements).each(function(i) {    
       $(this).prepend(h2ElemCount - i + '. ');    
          }); 

it works perfectly if the article is showed in the single page. When I paginate the post (because there are 10 to 15 subtitles) the counting starts from 1 for each subpage in article. How to keep the heading numbering throw whole article?

Berber
  • 23
  • 7

0 Answers0