Bluesky : bouton flottant « remonter en haut »
Un bouton flottant apparaît après défilement pour remonter en douceur en haut de la timeline.
Code à copier
// Floating "scroll to top" button appears after you scroll down
(function () {
if (document.getElementById('jz-bsk-scrolltop')) { return; }
var btn = document.createElement('button');
btn.id = 'jz-bsk-scrolltop';
btn.type = 'button';
btn.textContent = '↑';
btn.style.cssText = [
'position:fixed', 'right:24px', 'bottom:24px', 'z-index:99999',
'width:44px', 'height:44px', 'border-radius:50%',
'border:0', 'background:#0085ff', 'color:#fff',
'font-size:22px', 'cursor:pointer',
'box-shadow:0 4px 16px rgba(0,0,0,0.25)',
'display:none'
].join(';');
btn.addEventListener('click', function () {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
document.body.appendChild(btn);
function toggle() {
btn.style.display = (window.scrollY > 600) ? 'block' : 'none';
}
toggle();
window.addEventListener('scroll', toggle, { passive: true });
})();
Comment utiliser cet exemple
- Copiez le code avec le bouton ci-dessus.
- Installez JustZix (2 minutes) et ouvrez l'extension sur la page cible.
- Ajoutez une nouvelle règle correspondant à cette page.
- Collez le code dans le panneau JavaScript de la règle et enregistrez — il s'exécute à chaque visite de page.
Notez cet exemple
Aucune note — soyez le premier.