现在我尝试在我的 Angular 项目中实现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的演示页面上运行良好。它的构建与演示中的相同......所以我猜它的角度......
任何人都可以帮助或给我一个提示吗?