refactoring avec claude + ajout scroll-margin-top et désaffichage du panel au click sur les liens du toc
This commit is contained in:
parent
d51fc592ed
commit
01c5b098e4
14 changed files with 149 additions and 121 deletions
|
|
@ -1,13 +1,8 @@
|
|||
<nav class="toc">
|
||||
<div class="light toc_label if_toc">Sommaire</div>
|
||||
<div class="light toc_label">Sommaire</div>
|
||||
<ul>
|
||||
<?php
|
||||
preg_match_all('/<h3>(.*?)<\/h3>/', $content, $titres);
|
||||
foreach ($titres[1] as $index => $titre) {
|
||||
$slug = Str::slug($titre);
|
||||
echo '<li><a href="#' . $slug . '">' . $titre . '</a></li>';
|
||||
}
|
||||
?>
|
||||
<?php foreach ($page->tocItems() as $item): ?>
|
||||
<li><a href="#<?= $item['slug'] ?>"><?= $item['title'] ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue