Skip to content

Instantly share code, notes, and snippets.

@AlekVolsk
Last active February 10, 2019 10:55
Show Gist options
  • Save AlekVolsk/27fe40fcc30b9edb087a125d67cda493 to your computer and use it in GitHub Desktop.
Save AlekVolsk/27fe40fcc30b9edb087a125d67cda493 to your computer and use it in GitHub Desktop.
Нестандартная нумерация списков, когда номер доолжен начинаться не с 1, <ol start="num">...</ol>
ol {
counter-reset: list+N; /* here N = value at which to start numbering – 1 */
}
ol > li {
position: relative;
list-style-type: none;
}
ol > li:before {
position: absolute;
content: counter(list);
counter-increment: list;
}
jQuery(document).ready(function($) {
$('ol').each(function(){
var attr = parseInt($(this).attr('start'));
if (attr !== undefined && attr != 1) {
$(this).css('counter-reset','list+'+(attr-1));
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment