Browse Source

Fade articles content

Carlos Hernandez 3 years ago
parent
commit
4746bfb50f
2 changed files with 33 additions and 6 deletions
  1. 6
    5
      app_template/www/articles.html
  2. 27
    1
      app_template/www/css/main.css

+ 6
- 5
app_template/www/articles.html View File

@@ -62,10 +62,12 @@
62 62
 						for (element of articles) {
63 63
 							axios.get(`http://localhost:5000/articles/${element}`)
64 64
 								.then(response => {
65
-									let articlesHeading = document.querySelector("#articles-heading");
66
-									let articleElm = document.createElement("pre");
67
-									articleElm.textContent = response.data;
68
-									articlesHeading.appendChild(articleElm);
65
+									let articlesHeading = document.querySelector("#articles-heading").parentElement;
66
+									let articleDiv = document.createElement("button");
67
+									articleDiv.textContent = response.data;
68
+
69
+									articleDiv.classList.add("m-5", "article-content");
70
+									articlesHeading.appendChild(articleDiv);
69 71
 								})
70 72
 								.catch(error => console.error(error));
71 73
 						}
@@ -121,7 +123,6 @@
121 123
 										<div class="core">
122 124
 											<i class="icon-columns to-animate-2"></i>
123 125
 											<div class="fh5co-post to-animate">
124
-												<!-- <h3 async onload="fetchArticle();">Articles</h3> -->
125 126
 												<h3 id="articles-heading">Articles</h3>
126 127
 											</div>
127 128
 										</div>

+ 27
- 1
app_template/www/css/main.css View File

@@ -13,4 +13,30 @@ a img{
13 13
     animation-fill-mode: forwards;
14 14
     text-decoration: none;
15 15
     color: white;
16
-}
16
+}
17
+
18
+.article-content {
19
+    margin-top: 10px;
20
+    margin-bottom: 10px;
21
+    padding: 5px;
22
+    border: 1px solid #777;
23
+    max-height: 300px;
24
+    overflow: hidden;
25
+    text-overflow: ellipsis;
26
+    content: "";
27
+    position: relative;
28
+}
29
+
30
+button.article-content {
31
+    background: none;
32
+}
33
+
34
+.article-content:before {
35
+    content: '';
36
+    width: 100%;
37
+    height: 100%;
38
+    position: absolute;
39
+    left: 0;
40
+    top: 0;
41
+    background: linear-gradient(transparent 150px, white);
42
+}