Skip to content

Commit 5387ba4

Browse files
Change picture according to device
1 parent a5531b6 commit 5387ba4

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

src/styles/css/main.css

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/styles/css/main.css.map

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/styles/scss/_resets.scss

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
@import "./fonts";
2+
@import "./variables";
3+
4+
$mobile-image: "./../../images/hand_mobile.jpg";
5+
$pc-image: "./../../images/hand.jpg";
6+
7+
@mixin backgroundChange($device) {
8+
// background-position: center;
9+
@if ($device == "mobile") {
10+
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.3)),
11+
url($mobile-image);
12+
background-size: cover;
13+
background-position: center;
14+
}
15+
16+
@if ($device == "pc") {
17+
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.3)),
18+
url($pc-image);
19+
background-position: center;
20+
background-size: cover;
21+
}
22+
}
223

324
* {
425
margin: 0;
@@ -10,9 +31,11 @@
1031
body {
1132
min-height: 100vh;
1233
width: 100%;
13-
// background-image: url("./../../images/black-laptop.jpg");
14-
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.3)),
15-
url("./../../images/hand.jpg");
16-
background-size: cover;
17-
background-position: center;
34+
@include backgroundChange("pc");
35+
}
36+
37+
@media (max-height: $mobile-height) and (max-width: $mobile) {
38+
body {
39+
@include backgroundChange("mobile");
40+
}
1841
}

src/styles/scss/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ $accent-color: #d2d4dd;
33
$secondary-color: rgba(145, 104, 28, 0.89);
44
$mobile: 1000px;
55
$mobile-height: 750px;
6+

0 commit comments

Comments
 (0)