IE8中的Bootstrap 3轮播错误

Tom*_*Tom 3 jquery internet-explorer-8 twitter-bootstrap-3

我正在使用新版本的Bootstrap和jQuery

<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

但是我在IE8中收到以下错误

Message: 'a.support.transition.end' is null or not an object
Line: 7
Char: 3824
Code: 0
URI: http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js
Run Code Online (Sandbox Code Playgroud)

我找到了以下https://github.com/twbs/bootstrap/issues/7295 ..但是我想知道为什么更多人没有体验到这个问题.为什么IE8中的bootstrap似乎坏了?

Phi*_*hil 6

问题是开发人员忘记检查$.support.transition3.0.3版本,该版本仅在支持CSS过渡的浏览器中设置.相反,它们直接转到$.support.transition.endIE8中无法正常工作$.support.transition.

分支被标记为新版本之前,您可以尝试使用此修补...

<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script>
+function($) {
    'use strict';

    $.fn.carousel.Constructor.prototype.pause = function(e) {
        e || (this.paused = true)

        if (this.$element.find('.next, .prev').length && $.support.transition) {
            this.$element.trigger($.support.transition.end)
            this.cycle(true)
        }

        this.interval = clearInterval(this.interval)

        return this
    }
}(jQuery);
</script>
Run Code Online (Sandbox Code Playgroud)

这是直接从主分支中取出的,正如您所看到的,它$.support.transition首先进行检查.

仅供参考,它仅在一周前在大师中修复;) - https://github.com/twbs/bootstrap/commit/ad64b0acc826a1ad1b1adc719960ac3020cc3539