-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews.html
191 lines (178 loc) · 4.38 KB
/
news.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
---
layout: default
title: "Recent News"
permalink: /news/
header-title: "Newsroom"
header-desc: "Stay up to date on our upcoming events & latest announcements from Elara Aerospace."
header-image: /assets/images/blog/domenico-loia-hGV2TfOh0ns-unsplash.jpg
header-image-height: 3899
header-image-width: 5848
scroll-link: "#read-article"
---
<!-- Blog post card design from https://codepen.io/gh-o-st/pen/zYrddjP -->
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap");
* {
box-sizing: border-box;
}
.container:body {
display: flex;
justify-content: center;
align-items: center;
margin: 0;
background-color: #f7f8fc;
font-family: "Roboto", sans-serif;
color: #10182f;
min-height: 100vh;
}
.container {
display: flex;
width: 1040px;
justify-content: space-evenly;
flex-wrap: wrap;
}
.card {
margin: 10px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
overflow: hidden;
width: 300px;
transform: scale(1);
filter: grayscale(1);
transition: transform 0.2s cubic-bezier(.65,.05,.36,1), box-shadow 0.2s cubic-bezier(.65,.05,.36,1), filter 0.4s cubic-bezier(.65,.05,.36,1);
}
.card:hover {
cursor: pointer;
filter: none;
transform: scale(1.15);
box-shadow: 0 3px 25px rgba(0, 0, 0, 0.3);
}
.card-header img {
width: 100%;
height: 200px;
object-fit: cover;
}
.card-body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
padding: 20px;
min-height: 250px;
}
.tag {
background: #cccccc;
border-radius: 50px;
font-size: 12px;
margin: 0;
color: #fff;
padding: 2px 10px;
text-transform: uppercase;
cursor: pointer;
}
.tag-teal {
background-color: #47bcd4;
}
.card-body p {
font-size: 20px;
margin: 0 0 40px;
}
.user {
display: flex;
margin-top: auto;
}
.user img {
border-radius: 50%;
width: 40px;
height: 40px;
margin-right: 10px;
transform: scalex(-1);
}
.user-info small {
color: #545d7a;
}
</style>
<script>
let scroll = 0;
const card = document.querySelector('.card');
const unpack = function() {
};
const repack = function() {
};
window.addEventListener('wheel', function(evt) {
if (evt.deltaY > 0) {
scroll+=5;
} else if (evt.deltaY < 0 && scroll > 0) {
scroll-=5;
}
console.log(scroll);
});
</script>
<section id='read-article'>
<script>
// Function to detect if the user is browsing on a mobile device
function isMobileDevice() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
// Function to display different content based on device type
function displayContentBasedOnDevice() {
const outputElement = document.getElementById("output");
if (isMobileDevice()) {
// Display mobile-specific content
outputElement.innerHTML = `
<div id='mobile'>
<center>
<h1>{{ page.title }}</h1>
{% for post in site.posts %}
<p><a href="{{ post.url }}">{{ post.title }} ({{ post.date | date: "%-d %B %Y" }})</a></p>
{% endfor %}
</center>
</div>
`;
} else {
// Display desktop-specific content
outputElement.innerHTML = `
<div id='desktop'>
<center>
<h1>{{ page.title }}</h1>
<br/>
<div class="container">
{% for post in site.posts %}
<a href="{{ post.url }}">
<div class="card">
<div class="card-header">
<img src="{{ post.header-image }}" alt="{{ post.header-title }}" />
</div>
<div class="card-body">
<span class="tag tag-teal">{{ post.categories }}</span>
<p>{{ post.title }}</p>
<div class="user">
<img src="{{ post.author-image }}" alt="{{ post.author }}" />
<div class="user-info">
{% assign name_parts = post.author | split: " " %}
{% assign first_name = name_parts | first %}
{% assign last_name_initial = name_parts | last | slice: 0, 1 %}
<small><b>By {{ first_name }} {{ last_name_initial }}.</b> | On {{ post.date | date: "%-d %B %Y" }}</small>
</div>
</div>
</div>
</div>
</a>
<br />
{% endfor %}
</div>
</center>
</div>
`;
}
}
// Call the function when the page loads
window.onload = function() {
displayContentBasedOnDevice();
};
</script>
<div id="output">
<!-- Content will be dynamically loaded and inserted here based on device type -->
</div>
</section>