Skip to content

Commit b820452

Browse files
author
César R. Contreras
committed
new animation and responsive
1 parent 844d52e commit b820452

File tree

5 files changed

+37
-16
lines changed

5 files changed

+37
-16
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
"version": "1.0.1",
44
"author": "c1sar",
55
"description": "Angular 6 Simple slider",
6-
"keywords": ["Angular 6", "angular", "slider", "slide", "c1sar"],
6+
"keywords": [
7+
"Angular 6",
8+
"angular",
9+
"slider",
10+
"slide",
11+
"c1sar"
12+
],
713
"bugs": {
814
"url": "https://github.com/c1sar/ng2-slider/issues"
915
},
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<section #sliderSection class="slider">
2-
<div [class]="(slide.className) ? 'slide ' + slide.className : 'slide'" *ngFor="let slide of slides">
3-
<img [src]="slide.img" alt="">
2+
<div [class]="(slide.className) ? 'slide ' + slide.className : 'slide'"
3+
*ngFor="let slide of slides"
4+
[style.background-image]="'url('+slide.img+')'">
45
<span *ngIf="slide.html" [innerHtml]="slide.html"></span>
5-
<h2 *ngIf="slide.title" [innerHtml]="slide.title"></h2>
6-
<p *ngIf="slide.description" [innerHtml]="slide.description"></p>
6+
<h2 *ngIf="slide.title" [innerHtml]="slide.title" [class.h2-no-button]="!slide.button && !slide.description"></h2>
7+
<p *ngIf="slide.description" [class.p-no-button]="!slide.button" [innerHtml]="slide.description"></p>
78
<button *ngIf="slide.button" class="btn btn-primary" type="button" (click)="clickEvent(slide)" i18n>
89
{{slide.button.text}}
910
<span class="line-1"></span>
@@ -15,7 +16,7 @@ <h2 *ngIf="slide.title" [innerHtml]="slide.title"></h2>
1516
</section>
1617

1718
<section class="bullet-container">
18-
<span class="bullet" *ngFor="let x of slides; index as i;"
19+
<span class="bullet" *ngFor="let x of slides; index as i;"
1920
[class.square]="squareBullets"
2021
[class.active]="i+1==currentSlidePos" (click)="setSlide(i+1)"></span>
2122
</section>

projects/slider/src/lib/slider.component.scss

+18-8
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,26 @@ $mobile-tablet-portrait: "(max-width: 991px)";
1414
.slider {
1515
width: 100%;
1616
position: relative;
17-
height: 100%;
18-
min-height: 37.5rem;
17+
min-height: inherit;
1918
overflow-y: hidden;
2019
display: flex;
21-
align-items: center;
2220
overflow-x: hidden;
2321
.slide {
2422
width: 100%;
2523
min-width: 100%;
26-
height: 100%;
27-
min-height: 37.5rem;
24+
min-height: inherit;
2825
display: flex;
2926
justify-content: center;
3027
align-items: center;
3128
flex-direction: column;
3229
position: relative;
3330
user-select: none;
3431
pointer-events: none;
32+
background-size: cover;
33+
background-repeat: no-repeat;
34+
background-position: center center;
35+
background-attachment: fixed;
36+
3537
img {
3638
position: absolute;
3739
top: 0;
@@ -53,6 +55,9 @@ $mobile-tablet-portrait: "(max-width: 991px)";
5355
margin-right: 0.3125rem;
5456
user-select: none;
5557
pointer-events: none;
58+
&.h2-no-button {
59+
margin-bottom: 6.25rem;
60+
}
5661
}
5762
p {
5863
margin: -3.75rem 2.375rem 0.625rem 2.375rem;
@@ -62,11 +67,16 @@ $mobile-tablet-portrait: "(max-width: 991px)";
6267
font-family: inherit;
6368
line-height: 1.25rem;
6469
text-align: center;
70+
71+
&.p-no-button {
72+
margin-bottom: 6.25rem;
73+
}
6574
}
6675
.btn {
6776
z-index: 20;
6877
user-select: none;
6978
pointer-events: visible;
79+
margin-bottom: 6.25rem;
7080
}
7181
}
7282

@@ -104,8 +114,8 @@ $mobile-tablet-portrait: "(max-width: 991px)";
104114
background-color: $color-primary-500;
105115
}
106116
@media (hover: none) {
107-
&:hover {
108-
background-color: $color-white;
117+
&:hover {
118+
background-color: $color-white;
109119
}
110120

111121
&.active {
@@ -233,7 +243,7 @@ $a-size: 0.0063rem;
233243
transition: background-color 0.2s ease-in-out;
234244
background-color: transparent;
235245
}
236-
246+
237247
.line-1, .line-2, .line-3, .line-4 {
238248
background-color: $color-primary-500;
239249
}

src/app/app.component.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

22
* {
33
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
4-
}
4+
}
5+
6+
lib-slider {
7+
min-height: 100vh;
8+
}

0 commit comments

Comments
 (0)