Skip to content

Commit afc860c

Browse files
committed
fix background attachment
1 parent 57ccf86 commit afc860c

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

projects/slider/src/lib/slider.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div [class]="(slide.className) ? 'slide ' + slide.className : 'slide'"
33
*ngFor="let slide of slides"
44
[style.background-image]="'url('+slide.img+')'"
5-
[style.background-attachment]="option.animationType"
5+
[style.background-attachment]="(option.animationType===animationType.FIXED) ? 'fixed': 'initial'"
66
>
77
<span *ngIf="slide.html" [innerHtml]="slide.html"></span>
88
<h2 *ngIf="slide.title" [innerHtml]="slide.title" [class.h2-no-button]="!slide.button && !slide.description"></h2>

projects/slider/src/lib/slider.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ISlide } from './models/ISlide';
99
import { ISliderEvent } from './models/ISliderEvent';
1010
import { IOptions } from './models/IOptions';
1111
import { BulletType } from './models/bullet-type.enum';
12+
import { AnimationType } from './models/animation-type.enum';
1213

1314
const isMobile = navigator.userAgent.match(
1415
/(iPhone|iPod|iPad|Android|webOS|BlackBerry|IEMobile|Opera Mini)/i);
@@ -38,6 +39,7 @@ export class SliderComponent implements AfterViewInit, OnDestroy {
3839
timeBySlide: number;
3940

4041
bulletType = BulletType;
42+
animationType = AnimationType;
4143

4244
movementInterval: number;
4345

src/app/app.component.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- <lib-slider [slides]="slides" [squareBullets]="true" [option]="option"></lib-slider> -->
2-
<lib-slider [slides]="slides"></lib-slider>
1+
<lib-slider [slides]="slides" [option]="option"></lib-slider>
32

43
<h1>Slider Example</h1>

src/app/app.component.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Component } from '@angular/core';
22
import { ISlide } from 'projects/slider/src/lib/models/ISlide';
33
import { IOptions } from 'projects/slider/src/lib/models/IOptions';
4+
import { AnimationType } from 'projects/slider/src/lib/models/animation-type.enum';
5+
import { BulletType } from 'projects/slider/src/lib/models/bullet-type.enum';
46

57
@Component({
68
selector: 'app-root',
@@ -33,8 +35,10 @@ export class AppComponent {
3335
}
3436
];
3537

36-
// option: IOptions = {
37-
// animation: 'fixed'
38-
// };
38+
option: IOptions = {
39+
animationType: AnimationType.FIXED,
40+
bulletType: BulletType.SQUARE,
41+
timeBySlide: 4000
42+
};
3943

4044
}

0 commit comments

Comments
 (0)