How can I reset a CSS-counter to the start-attribute of the given list

前端 未结 6 1217
青春惊慌失措
青春惊慌失措 2020-11-30 06:50

I am using a self-styled, numbered list. How can I read the start-attribute and add it to the counter with CSS?

HTML

  1. Number
6条回答
  •  情书的邮戳
    2020-11-30 07:21

    To support

      even if counter-reset was enabled in Firefox:

      $('ol[start]').each(function() {
          var val = parseFloat($(this).attr("start"));
          $(this).find("li").first().attr("value", val);
      });
      

      jQuery script is based on Daniel Tonon's input.

提交回复
热议问题