logo

Paleta - Deixe colorido🎨

Palette — Construtor visual de páginas. Não precisa ser designer.

Demonstração ao vivo Baixar Palette

Scroll

Como faço para usar o scrollspy do Bootstrap?

22/02/2025, by Anônimo (não verificado)
Fóruns

I would like to use Bootstrap's scrollspy plugin in Drupal 8. So I edited the html.html.twig file replacing

<body{{ attributes.addClass(body_classes) }}>

With

<body{{ attributes.addClass(body_classes) }} data-spy="scroll" data-target=".nav-scrollspy" data-offset="50" >

Where .nav-scrollspy is the class of my navigation block. Additionally I added the following JavaScript to my theme:

$('body').scrollspy({ target: '.nav-scrollspy' });

But as this does not work I were wandering whether or not this plugin is already integrated in Drupals Bootstrap theme. Apparently not, as I could not locate such a file in themes/bootstrap/js/.

Unfortunately I did not find such a file in the web neither, so I am asking my self, where to get it and how to add it to Drupal?