mirror of
https://github.com/twbs/bootstrap.git
synced 2025-03-15 15:29:22 +01:00
Add information about IE 11 compatibility.
This commit is contained in:
parent
7491b14f03
commit
1da5b9f76a
@ -209,3 +209,40 @@ $('#yourTooltip').tooltip({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
## Compatibility with IE 11
|
||||||
|
|
||||||
|
Bootstrap v5 isn't designed to work with Internet Explorer 11, but you can add the following polyfills to make it work:
|
||||||
|
|
||||||
|
{% highlight html %}
|
||||||
|
<!-- Polyfill.io will load polyfills your browser needs -->
|
||||||
|
<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js"></script>
|
||||||
|
<script>
|
||||||
|
// Fix preventDefault for IE
|
||||||
|
(function () {
|
||||||
|
var workingDefaultPrevented = (function () {
|
||||||
|
var e = document.createEvent('CustomEvent')
|
||||||
|
e.initEvent('Bootstrap', true, true)
|
||||||
|
e.preventDefault()
|
||||||
|
return e.defaultPrevented
|
||||||
|
})()
|
||||||
|
|
||||||
|
if (!workingDefaultPrevented) {
|
||||||
|
var origPreventDefault = Event.prototype.preventDefault
|
||||||
|
Event.prototype.preventDefault = function () {
|
||||||
|
if (!this.cancelable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
origPreventDefault.call(this)
|
||||||
|
Object.defineProperty(this, 'defaultPrevented', {
|
||||||
|
get: function () {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
configurable: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
|
{% endhighlight %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user