Source : Resolve the conflict between Bootstrap 3 and PrototypeJS
.
Composants Bootstrap affectés :
- Collapsible components useful for building accordion and navigation.
- Dropdown menus : quand le menu se ferme, il disparaît entièrement.
- Modal dialogs
- Tootips
Solution sans chargement des librairies JavaScript via CMD :
Source : http://jsfiddle.net/dgervalle/hhBc6/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
jQuery.noConflict(); if (Prototype.BrowserFeatures.ElementExtensions) { var disablePrototypeJS = function (method, pluginsToDisable) { var handler = function (event) { event.target[method] = undefined; setTimeout(function () { delete event.target[method]; }, 0); }; pluginsToDisable.each(function (plugin) { jQuery(window).on(method + '.bs.' + plugin, handler); }); }, pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip']; disablePrototypeJS('show', pluginsToDisable); disablePrototypeJS('hide', pluginsToDisable); } jQuery(document).ready(function ($) { $('.bs-example-tooltips').children().each(function () { $(this).tooltip(); }); }); |
Solution avec chargement des librairies JavaScript via CMD :
Source : http://jsfiddle.net/dgervalle/e8Apv/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
require.config({ baseUrl: '/', paths: { 'jquery': "//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min", 'bootstrap': "//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min" }, shim: { 'bootstrap': ['jquery'] }, map: { '*': { 'jquery': 'jQueryNoConflict' }, 'jQueryNoConflict': { 'jquery': 'jquery' } } }); define('jQueryNoConflict', ['jquery'], function ($) { return $.noConflict(); }); if (Prototype.BrowserFeatures.ElementExtensions) { require(['jquery', 'bootstrap'], function ($) { // Fix incompatibilities between BootStrap and Prototype var disablePrototypeJS = function (method, pluginsToDisable) { var handler = function (event) { event.target[method] = undefined; setTimeout(function () { delete event.target[method]; }, 0); }; pluginsToDisable.each(function (plugin) { $(window).on(method + '.bs.' + plugin, handler); }); }, pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip']; disablePrototypeJS('show', pluginsToDisable); disablePrototypeJS('hide', pluginsToDisable); }); } require(['jquery', 'bootstrap'], function($) { $(document).ready(function () { $('.bs-example-tooltips').children().each(function () { $(this).tooltip(); }); }); }); |