IE8:使用swiper作为Angular Directive(Attribute)会引发错误

时间:2013-10-31 09:30:25

标签: javascript angularjs internet-explorer-8

现在我尝试在我的角度项目中实现swiper插件,除了ie8及以下工作正常。 错误:

SCRIPT5007: Unable to get property 'replace' of undefined or null reference 
idangerous.swiper-2.2.js, line 2190 character 10

在插件的行中,它将transform替换为matrix。但它似乎无法找到任何交换元素。

我的指示

// Slider / Swiper Plugin
app.directive('swipe', function(){
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            var slider = $(element).swiper(scope.$eval(attrs.swipe));
            $('.swipe__prev').on('click', function () {
                slider.swipePrev();
            });
            $('.swipe__next').on('click', function () {
                slider.swipeNext();
            });
            $(element).find('.swipe__pagi__element').on('click', function () {
                slider.swipeTo($('.swipe__pagi__element').index());
            });
        }
    };
});

我的HTML:

<div class="swiper-container swipe__container grid__item" swipe="{
        mode: 'horizontal',
        loop: false,
        autoplay: 5000,
        wrapperClass: 'swipe__wrapper',
        slideClass: 'swipe__slide',
        slidesPerView: '3',
        createPagination: false
    }">
        <div class="swipe-wrapper swipe__wrapper">
            <div class="swiper-slide swipe__slide">
                <img src="../images/slider_pic_01.jpg" alt="Gewinn 1">
            </div>
            .......
            <div class="swiper-slide swipe__slide">
                <img src="../images/slider_pic_15.jpg" alt="Gewinn 15">
            </div>
        </div>
    </div>
    <span class="swipe__prev"><i class="icon-caret-left"></i></span>
    <span class="swipe__next"><i class="icon-caret-right"></i></span>
    <div class="swipe__pagi"></div>

插件在IE8中的Demo Page上运行正常。它的构建与演示中的相同..所以我猜它的角度......

任何人都可以帮忙或给我一个暗示吗?

1 个答案:

答案 0 :(得分:0)

我解决了我现在感到愚蠢的问题。 简单回答。元素我调用swipe-wrapper,但我的css文件说swipeR-wrapper