Recherches récentes


Pas de recherche récente

Nicholas Smolney's Avatar

Nicholas Smolney

Adhésion le 15 avr. 2021

·

Dernière activité le 27 oct. 2021

Suivis

0

Abonnés

0

Activité totale

5

Votes

0

Abonnements

3

APERÇU DES ACTIVITÉS

Dernière activité effectuée par Nicholas Smolney

Nicholas Smolney a ajouté un commentaire,

Commentaire de la communauté Discussion - Tips and best practices from the community

and if anyone else is interested, I made a small addition to my css file to indent for subsequent levels

 

.toc ul{
padding-left: 20px;
}

Afficher le commentaire · Publication le 25 mai 2018 · Nicholas Smolney

0

Abonnés

0

Votes

0

Commentaire


Nicholas Smolney a ajouté un commentaire,

Commentaire de la communauté Discussion - Tips and best practices from the community

Hey Dave, see below for how I addressed this:

Basically the code didn't account for the case when your next heading is going back a level (current_level < previous_level), so I added that case and added an array to keep track of the previous levels.

/*** Table of contents code ***/
var $headers = $('.article-body h1');

if ($headers.length > 0) {
var $toc = $('

');
var $firstUl = $('

Afficher le commentaire · Publication le 25 mai 2018 · Nicholas Smolney

0

Abonnés

0

Votes

0

Commentaire