Skip to content

Commit f6f0c04

Browse files
Merge pull request #102 from jaygaikar-09/fix/lazy-loading-performance
Improve lazy loading and hero rendering performance
2 parents 046958c + d924dc3 commit f6f0c04

5 files changed

Lines changed: 10 additions & 9 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def score_single_project(project, user_skills, level, interest, time_availabilit
180180
- Use 2-space indentation
181181
- Every `<section>` must have a comment header explaining its purpose
182182
- All images must have an `alt` attribute
183+
- Use `loading="lazy"` on `<img>` tags by default; omit it only for images critical to the initial render (for example, a hero photo above the fold)
183184
- Use semantic elements: `<nav>`, `<section>`, `<footer>`, `<article>`
184185
- Keep inline styles out of templates — use CSS classes instead
185186

starter_code/portfolio.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@
426426
letter-spacing: -0.02em;
427427
}
428428
/* TODO Step 4: Replace these generic colours with real project screenshots.
429-
Use <img src="screenshot.png" alt="..." class="project-banner-img" />
429+
Use <img src="screenshot.png" alt="..." class="project-banner-img" loading="lazy" />
430430
and set height: 180px on .project-card img */
431431
.banner-blue { background: linear-gradient(135deg, #2335c2, #4f6ef7); }
432432
.banner-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
@@ -776,7 +776,7 @@ <h2 class="section-title">Things I Have Built</h2>
776776
<!-- TODO Step 4: Replace with your real project details -->
777777
<article class="project-card reveal">
778778
<div class="project-banner banner-blue">
779-
<!-- Replace this with a screenshot: <img src="screenshot.png" alt="Project name"> -->
779+
<!-- Replace this with a screenshot: <img src="screenshot.png" alt="Project name" loading="lazy"> -->
780780
Project One
781781
</div>
782782
<div class="project-body">

starter_code/weather_dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ <h1>Weather Dashboard</h1>
261261
</div>
262262

263263
<div class="temp-row">
264-
<img class="weather-icon" id="weather-icon" src="" alt="weather icon" />
264+
<img class="weather-icon" id="weather-icon" src="" alt="weather icon" loading="lazy" />
265265
<div>
266266
<span class="temp-value" id="temp-value"></span>
267267
<span class="temp-unit" id="temp-unit">C</span>

static/style.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ ul, ol { list-style: none; }
257257
width: 100%;
258258
}
259259

260-
/* Copy column */
261-
.hero-copy { max-width: 580px; }
260+
/* Copy column (order keeps layout when decorative blocks follow in DOM) */
261+
.hero-copy { max-width: 580px; order: 1; }
262262

263263
.hero-badge {
264264
display: inline-flex;
@@ -374,6 +374,7 @@ ul, ol { list-style: none; }
374374
display: flex;
375375
flex-direction: column;
376376
gap: 12px;
377+
order: 2;
377378
}
378379

379380
/* Floating info cards */

templates/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
Hero Section
4545
============================================================ -->
4646
<section class="hero" id="home">
47-
<div class="hero-bg-grid"></div>
48-
4947
<div class="hero-inner">
5048
<!-- Left: copy -->
5149
<div class="hero-copy">
@@ -89,7 +87,7 @@ <h1 class="hero-heading">
8987
</div>
9088
</div>
9189

92-
<!-- Right: abstract visual panel -->
90+
<!-- Hero visual loads after main content for performance -->
9391
<div class="hero-visual">
9492
<div class="hero-visual-card hero-visual-card--top">
9593
<div class="hvc-icon hvc-icon--blue">
@@ -142,7 +140,8 @@ <h1 class="hero-heading">
142140
</div>
143141
</div>
144142

145-
<!-- Decorative background blobs -->
143+
<!-- Hero visual loads after main content for performance -->
144+
<div class="hero-bg-grid"></div>
146145
<div class="hero-blob hero-blob-1"></div>
147146
<div class="hero-blob hero-blob-2"></div>
148147
</section>

0 commit comments

Comments
 (0)