Skip to content

Commit 4e8ad89

Browse files
Introduced responsive background image to contact page (title image).
Styled contact form to have small x margins on mobiles. Increased home page subtitle size (readability). Added set of images for contact page. Added function allowing orientation checking in javascript for future use. Added custom image overlay option to responsive background images (so we can have different colours / angles etc. for each one of them). The overlay is read from data-overlay attribute in responsive image element.
1 parent ac19667 commit 4e8ad89

11 files changed

+49
-22
lines changed

_pages/04_contact.html

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33
title: Contact
44
permalink: /contact/
55
---
6-
7-
<style>
8-
.contact__background-img {
9-
background-size: contain;
10-
background: linear-gradient(90deg,
11-
rgba(0, 0, 0, 0.75),
12-
rgba(0, 0, 0, 0.75)),
13-
url("{{ site.baseurl }}/static/images/contact/contact_top_1920x600px.jpg") top center no-repeat;
14-
}
15-
</style>
16-
17-
186
<section class="contact">
19-
<div class="contact__background-img">
7+
<div class="contact__background-img" data-image-type="responsive">
8+
<picture>
9+
<source srcset="../static/images/contact/contact_top_450x150px.jpg 450w,
10+
../static/images/contact/contact_top_960x300px.jpg 960w,
11+
../static/images/contact/contact_top_1920x600px.jpg 1920w"
12+
media="(orientation: landscape)"
13+
sizes="100vw">
14+
<source srcset="../static/images/contact/contact_top_750x650px.jpg 750w,
15+
../static/images/contact/contact_top_1650x1100px.jpg 1650w"
16+
media="(orientation: portrait)"
17+
sizes="100vw">
18+
<img class="responsive"
19+
src="../static/images/contact/contact_top_960x300px.jpg"
20+
alt="Contact Us"
21+
data-overlay="linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.75) 100%)">
22+
</picture>
23+
2024
<div class="row container-fluid">
2125
<div class="col-sm-12">
2226
<h2 class="contact__page-title">Contact Us</h2>

_sass/contact.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
@extend .page-subtitle;
2323
}
2424

25+
@media (max-width: 576px) {
26+
.contact__form {
27+
max-width: 96%;
28+
}
29+
}
30+
2531
.contact__form {
2632
margin-top: 5em;
2733
border-radius: 5px;

_sass/style.scss

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ a {
132132
}
133133

134134
.navigation__subtitle {
135-
font-size: 1.16em;
135+
font-size: 1.75em;
136136
font-family: 'Share Tech Mono', monospace;
137137
color: $page-subtitle;
138138
text-align: center;
@@ -145,7 +145,7 @@ a {
145145
margin-top: 40vh;
146146
}
147147
.navigation__subtitle {
148-
font-size: 1.43em;
148+
font-size: 1.9em;
149149
}
150150
}
151151

@@ -155,7 +155,7 @@ a {
155155
margin-top: 40vh;
156156
}
157157
.navigation__subtitle {
158-
font-size: 1.66em;
158+
font-size: 2em;
159159
}
160160
}
161161

@@ -165,7 +165,7 @@ a {
165165
margin-top: 40vh;
166166
}
167167
.navigation__subtitle {
168-
font-size: 2em;
168+
font-size: 2.25em;
169169
}
170170
}
171171

@@ -286,6 +286,7 @@ a {
286286

287287
@media (min-width: 768px) {
288288
.upcoming__col {
289+
margin-top: 0;
289290
margin-left: auto;
290291
margin-right: auto;
291292
}
@@ -298,6 +299,7 @@ a {
298299
font-size: 2.5em;
299300
color: $title-light;
300301
margin-top: 0;
302+
margin-bottom: 0;
301303
padding-top: 0.5em;
302304
padding-bottom: 0.5em;
303305
border-top-left-radius: 20px;
@@ -343,6 +345,7 @@ a {
343345
@media (min-width: 768px) {
344346
.upcoming__button-row {
345347
margin-top: 5.5%;
348+
margin-bottom: 5.5%;
346349
}
347350
}
348351

index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717
static/images/title_photo/title_glass_building_1080x1920.jpg 1080w,
1818
static/images/title_photo/title_glass_building_1125x2436.jpg 1125w,
1919
static/images/title_photo/title_glass_building_1242x2436.jpg 1242w,
20-
static/images/title_photo/title_glass_building_1442x2562.jpg 1442w,
21-
"
20+
static/images/title_photo/title_glass_building_1442x2562.jpg 1442w"
2221
media="(orientation: portrait)"
2322
sizes="100vw">
24-
<img class="responsive" src="static/images/title_photo/title_glass_building_960x540.jpg" alt="Python Sprints Title Image">
23+
<img class="responsive"
24+
src="static/images/title_photo/title_glass_building_960x540.jpg"
25+
alt="Python Sprints Title Image"
26+
data-overlay="linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.8) 100%)">
2527
</picture>
2628

2729
<div class="row">
2830
<div class="col-md-12">
2931
<h1 class="navigation__title">Python Sprints</h1>
30-
<h2 class="navigation__subtitle"><em>The World Is Waiting For Your Code</em></h2>
32+
<h2 class="navigation__subtitle"><em>The World Needs Your Code</em></h2>
3133
</div>
3234
</div>
3335
</div>
Loading
8.14 KB
Loading
-68.3 KB
Binary file not shown.
Loading
Loading
78.3 KB
Loading

static/js/site.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ $(document).ready(function () {
1616
});
1717

1818

19+
function readDeviceOrientation() {
20+
21+
return window.matchMedia("(orientation: portrait)").matches;
22+
}
23+
1924
function stopBodyScrolling (bool) {
2025
/**
2126
* Required to stop body scrolling on iOS devices (safari ignores
@@ -87,9 +92,16 @@ class ResponsiveBackgroundImage {
8792

8893
update() {
8994
let src = typeof this.img.currentSrc !== 'undefined' ? this.img.currentSrc : this.img.src;
95+
let image = this.img;
96+
let overlay = image.getAttribute("data-overlay");
97+
if (overlay === null || overlay === undefined) {
98+
overlay = "";
99+
}
100+
90101
if (this.src !== src) {
91102
this.src = src;
92-
this.element.style.backgroundImage = 'linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url("' + this.src + '")';
103+
104+
this.element.style.backgroundImage = overlay + ', url("' + this.src + '")';
93105
}
94106
}
95107
}

0 commit comments

Comments
 (0)