conflicting bootstrap.js

Permalink
We're building a package that registers an up to date bootstrap css and js as assets. The problem is that if the package is installed on a c5 that runs a theme which pulls in its own bootstrap.js, our package no longer functions correctly. As soon as we pull out the package's bootstrap.js file, it all runs fine again - we assume it is running off the theme's bootstrap js file? The package runs fine on elemental theme probably because Elemental theme doesn't require or override bootstrap js, only the bootstrap css.

The reason we are pulling in bootstrap is to use the modal, and this is not included in the version of bootstrap that ships with C5.7. We've also looked into using the c5 modal/dialog, but can't find much in the docs about using this in a package for C5.7. Our modal needs to have a form inside it, so other bootstrap things like popovers etc wouldn't really work we think.

We're a bit stuck on where to go next to make this plugin robust with themes that pull in their own bootstrap. What we mean by "no longer functions correctly" is that the modal will appear, then disapear when initiated on button click, and won't hold in view so that the form in it can be filled out. When we inspect the page source code, it clearly shows both the package bootstrap.js and the theme's bootstrap.js being (or trying to be) loaded.

Any suggestions welcome :)

View Replies:
pixelhero replied on at Permalink Reply
pixelhero
You may find that the c5 bootstrap is being assigned to a specific global variable, you could override it with your bootstrap js (it likely has a check to see if it already exists, work to remove that check and force it to overwrite). But that may break other things.

If you need a modal, why not try a 3rd party modal and use bootstrap markup for the window?
This one is very customisable in terms of modal window content and markup:http://dimsemenov.com/plugins/magnific-popup/...
mashanab replied on at Permalink Reply
Perfect !

The Magnific popup you've suggested we try has worked a treat

Thanks Pixelhero :)