<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>c-scrollspy callback personnalisé</title>
<style>
body {
padding: 2em;
color: #333;
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif;
line-height: 1.5em;
background-color: ghostwhite;
padding-bottom: 150vh;
}
nav {
display: flex;
flex-wrap: wrap;
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: dodgerblue;
}
nav a {
color: white;
padding: 1em 2em;
text-transform: uppercase;
text-decoration: none;
}
a.active {
color: yellow;
}
a.active-2 {
color: green;
}
a.active-3 {
color: fuchsia;
}
section {
height: 130vh;
padding: 3em;
background-color: #EEE;
margin-bottom: 3em;
scroll-margin-top: 40px;
}
</style>
</head>
<body>
<section c-scrollspy="mostSimple">
<h2>Callback personnalisé mostSimple</h2>
<p>Ce callback personnalisé appelé "mostSimple" retourne un simple console.log(data) de l'IntersectionObserver (voir la console).</p>
<p>Si les options ne sont pas spécifiées, comme sur cet exemple, cScrollspy utilise les options du callback anchor.</p>
</section>
<section c-scrollspy="multipleThesholds">
<h2>Callback personnalisé multipleThesholds</h2>
<p>Ce callback personnalisé appelé "multipleThesholds" modifie la couleur de l'arrière-plan à chaque seuil.</p>
</section>
<section c-scrollspy="multipleThesholds">
<h2>Callback personnalisé multipleThesholds seconde instance</h2>
<p>Modifie la couleur de l'arrière-plan à chaque seuil.</p>
</section>
<script src="/assets/c-scrollspy.js"></script>
<script src="/assets/c-scrollspy-callbacks.js"></script>
</body>
</html>