Tag: html heading

使用分页postH2标题编号无法正常工作

我正在使用来自jQuery自动标题编号的 jQuery脚本来进行H2字幕计数。 我刚刚更新了脚本: var h2Elements = $(‘article’).find(‘h2’); var h2ElemCount = h2Elements.length; $(h2Elements).each(function(i) { $(this).prepend(h2ElemCount – i + ‘. ‘); }); 如果文章显示在单个页面中,它可以很好地工作。 当我对post进行分页时(因为有10到15个字幕),对于文章中的每个子页面,计数从1开始。 如何保持标题编号扔整篇文章?

jQuery自动标题编号

我在网站上有10-15个H2标签字幕的文章。 有点喜欢。 Name of article Subtitle ….. Subtitle ….. Subtitle ….. Subtitle ….. 那么,问题是如何通过jQuery按降序自动为每个H2标签(副标题)提供数字? Name of article 15.Subtitle ….. 14.Subtitle ….. 13.Subtitle ….. 12.Subtitle ….. 我知道如何通过CSS计数器来做,但文章可以包含不同数量的字幕。 我已经使用jQuery主题检查了类似的标题自动编号H1-H6 ,但它不是我想要的。