huai-sian il y a 3 ans
Parent
commit
2e621139c0
4 fichiers modifiés avec 417 ajouts et 19 suppressions
  1. 24 0
      index_designerList.html
  2. 35 19
      js/index-designer.js
  3. 357 0
      json/designers-143.json
  4. 1 0
      json/designers.json

+ 24 - 0
index_designerList.html

@@ -39,6 +39,29 @@
 
     <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
     <link rel="stylesheet" href="css/list-style.css">
+    <script>
+      !function (f, b, e, v, n, t, s) {
+          if (f.fbq) return;
+          n = f.fbq = function () {
+              n.callMethod ?
+                  n.callMethod.apply(n, arguments) : n.queue.push(arguments)
+          };
+          if (!f._fbq) f._fbq = n;
+          n.push = n;
+          n.loaded = !0;
+          n.version = '2.0';
+          n.queue = [];
+          t = b.createElement(e);
+          t.async = !0;
+          t.src = v;
+          s = b.getElementsByTagName(e)[0];
+          s.parentNode.insertBefore(t, s)
+      }(window, document, 'script',
+          'https://connect.facebook.net/en_US/fbevents.js');
+      fbq('init', '585285442299590');
+      fbq('track', 'PageView');
+    </script>
+   
 </head>
 <body>
     <div style="overflow-x:hidden;">
@@ -1800,6 +1823,7 @@
     <script async defer src="js/index-designer.js"></script>
     <script async defer src="js/index-list.js"></script>
     <script src="js/lazy-load.js" async></script>
+    
 </body>
 
 </html>

+ 35 - 19
js/index-designer.js

@@ -51,6 +51,8 @@ function group(data) {
 // pagination variables
 let num_per_page = 9;
 let n = 0;
+let n_video = 0;
+let n_columns = 0;
 let totalPages = {
     intro: 0,
     video: 0,
@@ -102,11 +104,11 @@ window.onload = function(){
         console.log(designer['Content'][0]['Carddata']);
         renderinfoCard(designer);
         renderTab(designer['Content']);
-        renderTabContent(designer['Content']);
+        renderTabContent(designer['Content'], designer);
         renderModalTitle(designer['CompanyName']);
-        // $(window).scroll(function() {
-        //     loadMore(designer);
-        // })
+        $(window).scroll(function() {
+            loadMore(designer);
+        })
     });
 }
   
@@ -334,7 +336,7 @@ function renderCard(content, i = 0){
 }
 
 
-function renderTabContent(content) {
+function renderTabContent(content, meta) {
     let tabStr = '';
     for(let i = 0;i < content.length; i ++) {
         let cardData = ''
@@ -355,12 +357,22 @@ function renderTabContent(content) {
                                     ${cardData}
                                 </article>
                             </div>
+                            <div class="col-md-4 fb__block">
+                            <div id="fb-container">
+                                <div class="fb-page" data-href="${meta['FB_link']}" data-tabs="timeline" data-width="320" data-height="700" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">
+                                    <blockquote cite="${meta['FB_link']}" class="fb-xfbml-parse-ignore">
+                                        <a href="${meta['FB_link']}">${meta['CompanyName']}</a>
+                                    </blockquote>
+                                </div>
+                            </div>
                         </div>
-                    </div>`
-        
+                    </div>
+                    <script async defer crossorigin="anonymous" src="https://connect.facebook.net/zh_TW/sdk.js#xfbml=1&version=v9.0" nonce="7TsDzQN7"></script>
+                   `
+                    
         } else {
-            // for(let j = 0;j < (content[i].Carddata.length < num_per_page? content[i].Carddata.length: num_per_page); j ++) {
-            for(let j = 0;j < content[i].Carddata.length; j ++) {
+            for(let j = 0;j < (content[i].Carddata.length < num_per_page? content[i].Carddata.length: num_per_page); j ++) {
+            // for(let j = 0;j < content[i].Carddata.length; j ++) {
                 let tagStr = '';
                 for(let k = 0;k < content[i].Carddata[j].tags.length; k ++) {
                     tagStr += `<a href="${content[i].Carddata[j].tags[k]['link']}" class="card__tag" target="_blank">${content[i].Carddata[j].tags[k]['name']}</a>`
@@ -386,8 +398,8 @@ function renderTabContent(content) {
                             ${cardData}
                         </div>
                     </div>`
-                    // let key = content[i]['Tabtag'];
-                    // totalPages[key] = content[i].Carddata.length;
+                    let key = content[i]['Tabtag'];
+                    totalPages[key] = content[i].Carddata.length;
         }
         
         
@@ -456,11 +468,13 @@ function loadMore(designer) {
         let last = document.querySelector('#pills-intro .work__row>div:last-child');
         let pageNum = Math.ceil(totalPages.intro / 9);
         if ($(this).scrollTop() > last.offsetTop) {
+            console.log('over');
             if(n >= pageNum) {
                 n = pageNum;
                 return;
               } else {
                 n ++;
+                console.log('letteer');
                 console.log('test');
                 let append = '';
                 let d = designer['Content'][0].Carddata.slice(9*n, (9*n)+9);
@@ -487,15 +501,17 @@ function loadMore(designer) {
         
         }
     } else if (nowTab === document.querySelector('#pills-video')) {
-        let pageNum = Math.ceil(totalPages.intro / 9);
+        let pageNum = Math.ceil(totalPages.video / 9);
         let last = document.querySelector('#pills-video .work__row>div:last-child');
+        console.log('over-video');
         console.log(last);
         if ($(this).scrollTop() > last.offsetTop) {
-            if(n >= pageNum) {
-                n = pageNum;
+            if(n_video >= pageNum) {
+                n_video = pageNum;
                 return;
               } else {
-                n ++;
+                console.log('pass-video');
+                n_video ++;
                 console.log('test');
                 let append = '';
                 let d = designer['Content'][0].Carddata.slice(9*n, (9*n)+9);
@@ -524,13 +540,13 @@ function loadMore(designer) {
         }
     } else if (nowTab === document.querySelector('#pills-columns')) {
         let last = document.querySelector('#pills-columns .work__row>div:last-child');
-        let pageNum = Math.ceil(totalPages.intro / 9);
+        let pageNum = Math.ceil(totalPages.columns / 9);
         if ($(this).scrollTop() > last) {
-            if(n >= pageNum) {
-                n = pageNum;
+            if(n_columns >= pageNum) {
+                n_columns = pageNum;
                 return;
               } else {
-                n ++;
+                n_columns ++;
                 console.log('test');
                 let append = '';
                 let d = designer['Content'][0].Carddata.slice(9*n, (9*n)+9);

+ 357 - 0
json/designers-143.json

@@ -8,6 +8,7 @@
       "Designerimg": "https://cloud.hhh.com.tw/gs/designer/designer494_00.jpg",
       "Description": "恆岳空間設計|蔡岳儒 室內設計師,為台北老屋翻新好評推薦的室內設計師, 將老屋妙手回春成現代風小豪宅,亦擅長置入日式精闢手工藝術融入室內空間設計中。",
       "Approve": "★老屋翻新‧住宅改造",
+      "FB_link": "https://www.facebook.com/Sdesign2018",
       "Basics": [
         {"title": "免費專線:", "link": "tel:0809-000-123#18890", "data": "0809-000-123#18890"},
         {"title": "諮詢專線:", "link": "tel:02-2562-7755", "data": "02-2562-7755"},
@@ -203,6 +204,326 @@
               ],
               "views": 950,
               "dateSort": 7
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 899,
+              "dateSort": 5
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ],
+              "views": 800,
+              "dateSort": 6
             }
           ]
         },
@@ -411,6 +732,42 @@
                 }
               ]
             },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ]
+            },
+            { 
+              "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
+              "title": "藏岳│混搭風│26坪",
+              "tags": [
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                { 
+                  "name": "混搭風",
+                  "link": ""
+                },
+                {
+                  "name": "混搭風",
+                  "link": ""
+                }
+              ]
+            },
             { 
               "imgURL": "https://images.hhh.com.tw/uploads/_hcase_orig/designer494_39_05.jpg",
               "title": "藏岳│混搭風│26坪",

+ 1 - 0
json/designers.json

@@ -8,6 +8,7 @@
       "Designerimg": "https://cloud.hhh.com.tw/gs/designer/designer494_00.jpg",
       "Description": "恆岳空間設計|蔡岳儒 室內設計師,為台北老屋翻新好評推薦的室內設計師, 將老屋妙手回春成現代風小豪宅,亦擅長置入日式精闢手工藝術融入室內空間設計中。",
       "Approve": "★老屋翻新‧住宅改造",
+      "FB_link": "https://www.facebook.com/Sdesign2018",
       "Basics": [
         {"title": "免費專線:", "link": "tel:0809-000-123#18890", "data": "0809-000-123#18890"},
         {"title": "諮詢專線:", "link": "tel:02-2562-7755", "data": "02-2562-7755"},