瀏覽代碼

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
+}