To use the tooltip component in Bootstrap 4 you need to include tether.
I have tried to do this using the recommended RequireJs method in Magento2, but am not having much luck.
In my requirejs-config.js I have the following:
var config = {
paths: {
"tether" : "js/bootstrap/tether.min",
"bootstrap": "js/bootstrap/bootstrap.min"
},
"shim": {
"tether": ["jquery"],
"bootstrap": ["tether", "jquery"]
}
};
So, the idea is that I am using shim to make sure bootstrap has a dependency on tether.
I then use the following to use the tooltips:
define(['jquery','tether','bootstrap','domReady!'], function ($) {
'use strict';
$(function() {
$('[data-toggle="tooltip"]').tooltip()
});
});
The end result is that I get a JavaScript error:
"Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)"
I have tried many things based on some Google searching and have tried the following combinations:
var config = {
paths: {
"tether" : "js/bootstrap/tether.min",
"bootstrap": "js/bootstrap/bootstrap.min"
},
"shim": {
"tether": ["jquery"],
"bootstrap": ["tether", "jquery"]
},
deps: ["js/bootstrap/tether.min"]
};
var config = {
paths: {
"tether" : "js/bootstrap/tether.min",
"bootstrap": "js/bootstrap/bootstrap.min"
},
"shim": {
"js/bootstrap/tether.min": ["jquery"],
"js/bootstrap/bootstrap.min": ["js/bootstrap/tether.min", "jquery"]
}
};
define(['jquery','bootstrap','domReady!'], function ($) {
'use strict';
$(function() {
$('[data-toggle="tooltip"]').tooltip()
});
});
Not sure if anyone has come across this, but if anyone knows what I am missing or not adding it would be massively appreciated.