-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
64 lines (58 loc) · 4.45 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" value="MOUAD NASSRI">
<title>Infinite Scroll</title>
<link rel="shortcut icon" href="#">
<link rel="stylesheet" href="index.css">
<script src="index.js" defer></script>
</head>
<body>
<img src="" id="background-image" alt=""> <!-- background image -->
<div id="app">
<h1>Infinite scroll</h1>
<p class="text my8">Hi, my name is <strong>Mouad Nassri</strong>, web developer from Morocco. In this snippet is an <strong>infinite scroll</strong> feature that uses <strong>The New York Times</strong> API to fetch articles and every time the user scroll down to the last article we fetch more articles.</p>
<p class="text my8">This example use <strong>Intersection Observer API</strong> instead of observing old school scroll event and calculationg positions and scroll values.</p>
<h2 class="text-center">The New York Times Articles About Space</h2>
<div id="articles">
<!-- articles will be loaded here at runtime (AJAX Response) -->
</div>
<!-- First fetch loading -->
<div id="first-load-loading-box" class="full-center flex-column">
<svg class="spinner infinite-rotate" style="width: 24px; height: 24px; margin: 14px 0;" fill="none" viewBox="0 0 16 16">
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke"></circle>
<path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke"></path>
</svg>
<span class="fs13">please wait..</span>
</div>
<!-- fetch more -->
<div id="fetch-more-loading-box" class="full-center flex-column none" style="margin: 14px 0;">
<svg class="spinner infinite-rotate" style="width: 24px; height: 24px; margin: 14px 0;" fill="none" viewBox="0 0 16 16">
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke"></circle>
<path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke"></path>
</svg>
<span class="fs13">fetching more articles..</span>
</div>
<!-- article component to clone since we don't use components -->
<article class="article article-skeleton none">
<div class="full-center thumbnail-box">
<img src="" class="thumbnail" alt="">
</div>
<div class="meta-box" style="height: max-content;">
<h2 class="title"><a href="">Lorem ipsum dolor sit amet consectetur adipisicing elit.</a></h2>
<p class="summary">Lorem ipsum dolor sit amet consectetur adipisicing elit. At molestiae odio expedita assumenda ipsam earum ex, porro, quod architecto exercitationem aut dolor reprehenderit optio. Ducimus ullam asperiores veniam culpa ut?</p>
<div class="align-center my8">
<svg class="size14 mr6" style="margin-top: -2px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M357.51,334.33l28.28-28.27a7.1,7.1,0,0,1,12.11,5V439.58A42.43,42.43,0,0,1,355.48,482H44.42A42.43,42.43,0,0,1,2,439.58V128.52A42.43,42.43,0,0,1,44.42,86.1H286.11a7.12,7.12,0,0,1,5,12.11l-28.28,28.28a7,7,0,0,1-5,2H44.42V439.58H355.48V339.28A7,7,0,0,1,357.51,334.33ZM495.9,156,263.84,388.06,184,396.9a36.5,36.5,0,0,1-40.29-40.3l8.83-79.88L384.55,44.66a51.58,51.58,0,0,1,73.09,0l38.17,38.17A51.76,51.76,0,0,1,495.9,156Zm-87.31,27.31L357.25,132,193.06,296.25,186.6,354l57.71-6.45Zm57.26-70.43L427.68,74.7a9.23,9.23,0,0,0-13.08,0L387.29,102l51.35,51.34,27.3-27.3A9.41,9.41,0,0,0,465.85,112.88Z"/></svg>
<span class="fs13 bold author-and-date">By Mouad Nassri</span>
</div>
<div class="keywords-box">
<span class="fs13 bold">Keywords :</span>
</div>
</div>
</article>
</div>
</body>
</html>