Skip to content
This repository was archived by the owner on Aug 6, 2022. It is now read-only.

Commit 638e17c

Browse files
committed
Fixed component controls to work in IE11
1 parent 7b24e5e commit 638e17c

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

src/lib/swiper.component.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
<div [hidden]="config?.scrollbar !== '.swiper-scrollbar'" class="swiper-scrollbar"></div>
77

8-
<div [hidden]="config?.prevButton !== '.swiper-button-prev'" class="swiper-button-prev" [attr.disabled]="isAtFirst"></div>
9-
<div [hidden]="config?.nextButton !== '.swiper-button-next'" class="swiper-button-next" [attr.disabled]="isAtLast"></div>
8+
<div [hidden]="config?.prevButton !== '.swiper-button-prev'" class="swiper-button-prev" [attr.disabled]="isAtFirst || null"></div>
9+
<div [hidden]="config?.nextButton !== '.swiper-button-next'" class="swiper-button-next" [attr.disabled]="isAtLast || null"></div>
1010

11-
<div [hidden]="config?.pagination !== '.swiper-pagination'" class="swiper-pagination" (click)="directiveRef.setIndex($event.target.attributes.index.value)"></div>
11+
<div [hidden]="config?.pagination !== '.swiper-pagination'" class="swiper-pagination" (click)="directiveRef.setIndex($event.target.getAttribute('index'))"></div>
1212
</div>

src/lib/swiper.component.scss

+6-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ swiper {
4848
pointer-events: none;
4949

5050
.swiper-pagination-handle {
51+
position: relative;
52+
53+
padding: 4px;
5154
margin: 2px;
5255

5356
cursor: pointer;
5457
pointer-events: all;
5558

5659
.swiper-pagination-bullet {
57-
pointer-events: none;
60+
margin: 0;
5861
}
5962

6063
.swiper-pagination-bullet-last,
@@ -105,7 +108,7 @@ swiper {
105108

106109
&.swiper-pagination-bullet-last,
107110
&.swiper-pagination-bullet-first {
108-
margin: 5px -1px;
111+
margin: 0 -1px;
109112
}
110113
}
111114
}
@@ -128,7 +131,7 @@ swiper {
128131
.swiper-pagination-bullet {
129132
&.swiper-pagination-bullet-last,
130133
&.swiper-pagination-bullet-first {
131-
margin: -1px 5px;
134+
margin: -1px 0;
132135
}
133136
}
134137
}

src/lib/swiper.component.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,20 @@ export class SwiperComponent implements DoCheck {
134134
}
135135

136136
if (options.pagination === '.swiper-pagination' && !options.paginationBulletRender) {
137+
options.paginationClickable = false;
138+
137139
if (!this.paginationBulletRender) {
138140
this.paginationBulletRender = (swiper, index, className) => {
141+
let bullet = `<span class="${className} ${className}-middle" index="${index}"></span>`;
142+
139143
if (index === 0) {
140-
return '<span class="swiper-pagination-handle" index=' + index + '>' +
141-
'<span class="' + className + ' ' + className + '-first"></span></span>';
144+
bullet = `<span class="${className} ${className}-first" index="${index}"></span>`;
145+
142146
} else if (index === (swiper.slides.length - 1)) {
143-
return '<span class="swiper-pagination-handle" index=' + index + '>' +
144-
'<span class="' + className + ' ' + className + '-last"></span></span>';
145-
} else {
146-
return '<span class="swiper-pagination-handle" index=' + index + '>' +
147-
'<span class="' + className + ' ' + className + '-middle"></span></span>';
147+
bullet = `<span class="${className} ${className}-last" index="${index}"></span>`;
148148
}
149+
150+
return `<span class="swiper-pagination-handle" index="${index}">${bullet}</span>`;
149151
};
150152
}
151153

tslint.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
"radix": true,
8080
"semicolon": [
8181
true,
82-
"always"
82+
"always",
83+
"ignore-interfaces"
8384
],
8485
"triple-equals": [
8586
true,
@@ -107,13 +108,13 @@
107108
"check-type"
108109
],
109110
"directive-selector": [
110-
true,
111+
false,
111112
"attribute",
112113
false,
113114
"camelCase"
114115
],
115116
"component-selector": [
116-
true,
117+
false,
117118
"element",
118119
false,
119120
"kebab-case"

0 commit comments

Comments
 (0)