Переглянути джерело

Sort content based on type

Carlos Hernandez 2 роки тому
джерело
коміт
6ecf07f093
2 змінених файлів з 79 додано та 120 видалено
  1. 54
    120
      dato_template/index.html
  2. 25
    0
      dato_template/sortposts.js

+ 54
- 120
dato_template/index.html
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 25
- 0
dato_template/sortposts.js Переглянути файл

@@ -0,0 +1,25 @@
1
+function sort_posts(id) {
2
+    console.log("Executing function.");
3
+    var value = document.getElementById("my-selection").value;
4
+    console.log(value);
5
+
6
+    var parentNode = document.getElementById("rows-parent");
7
+    var instagramRow = document.getElementById("instagram-row");
8
+    var podcastsRow = document.getElementById("podcasts-row");
9
+    var articlesRow = document.getElementById("articles-row");
10
+    if (value == 1) {
11
+        parentNode.appendChild(podcastsRow);
12
+        parentNode.appendChild(instagramRow);
13
+        parentNode.appendChild(articlesRow);
14
+    }
15
+    else if (value == 2) {
16
+        parentNode.appendChild(instagramRow);
17
+        parentNode.append(articlesRow);
18
+        parentNode.appendChild(podcastsRow);
19
+    }
20
+    else if (value == 3) {
21
+        parentNode.append(articlesRow);
22
+        parentNode.appendChild(podcastsRow);
23
+        parentNode.appendChild(instagramRow);
24
+    }
25
+}