Roots Discourse

Activate bootstrap js (popover etc)

Hello, I’m new to the community, but a great fan of roots. However I struggle with finding the correct (easy) way of activating the bootstrap javascripts, for example:
assets/js/plugins/bootstrap/popover.js

Using Roots 6.5.2
compiling through ‘grunt watch’

I hope I’m not asking this in the wrong place. Would not like to offend the fine roots community.

I found the solution. In _main.js I added the line

$('[data-toggle="popover"]').popover();

right before the two closing lines

$(document).ready(UTIL.loadEvents);

})(jQuery); // Fully reference jQuery after this point. 

This works well if you are using the data-attributes like so:

<a href="http://www.domain.com" target="_blank" data-toggle="popover" title="Lorem ipsum" data-content="Nullam quis risus eget urna mollis ornare vel eu leo. Donec sed odio dui." data-trigger="hover">

After studying the gruntfile I realised popover.js is already ‘active’ in the theme default state.

Any particular reason you did not place it on line 25 as the comments instruct?

Hi cfx,
no, there was no reason, other than lack of knowledge. I didn’t realize the “//common” comment referred to “general” code. I just noticed that it seemed to be about particular pages in that section of the code.

Thanks for taking the time to point this out! Now I’ll be able to do this the right way.