편집 요약 없음 |
편집 요약 없음 |
||
3번째 줄: | 3번째 줄: | ||
var passedTOC = false; | var passedTOC = false; | ||
$(' | $('h2, h3, h4, h5, h6').each(function() { | ||
if (!passedTOC) { | if (!passedTOC) { | ||
if ($ | if ($(this).prevAll('#toc').length > 0) { | ||
passedTOC = true; | passedTOC = true; | ||
} else { | |||
return; | |||
} | } | ||
} | } | ||
var numberLink = $('<a>') | |||
.attr('href', '#toc') | |||
.text(count + '. ') | |||
.addClass('mw-link') // 목차 숫자 파란색 링크 | |||
.css({ | |||
'text-decoration': 'none', | |||
'margin-right': '5px' | |||
}); | |||
$(this).prepend(numberLink); | |||
count++; | |||
}); | }); | ||
}); | }); |