浏览代码

add Anchor

SyuanYu 2 年之前
父节点
当前提交
d6c9d8d3c8

+ 3 - 3
layouts/collection/single.html

@@ -88,7 +88,7 @@
                     <div class="sec02_content_text mt-3 mt-lg-0">
                         <h2 class="style_house_subtitle"> {{ .Params.collection_name }}</h2>
                         <p>
-                            {{.Params.collection_description }}
+                            {{.Params.collection_description | safeHTML }}
                         </p>
                     </div>
                 </div>
@@ -100,7 +100,7 @@
                     <div class="sec02_content_text mt-3 mt-lg-0">
                         <h2 class="style_house_subtitle"> {{ .Params.collection_name }}</h2>
                         <p>
-                            {{.Params.collection_description }}
+                            {{.Params.collection_description | safeHTML }}
                         </p>
                     </div>
                 </div>
@@ -157,7 +157,7 @@
     <div class="style_house_sec06 container-fluid px-0">
         <div class="row px-0 mx-0">
             <div class="col-6 col-sm-6 bg-serve ps-0">
-                <a href="/collection/">
+                <a href="/room_planner/">
                     <div class="bg-img"></div>
                 </a>
             </div>

+ 21 - 1
layouts/store/store.html

@@ -11,7 +11,7 @@
   <section class="bhouseweb_loc_banner">
     <img src="/img/banner/bn_store@2x.png" class="banner-img card-img" alt="...">
   </section>
-  <div class="brand_content">
+  <div class="brand_content" id="scope">
     <div class="card bg-transparent border-0 rounded-0">
       <img src="/img/store/map.png" class="sec01_store_map_img card-img rounded-0" alt="...">
       <div class="store_cta_box_reserve">
@@ -334,6 +334,26 @@
           }
 
         });
+      } else if (storeVal === "scope") {
+        $("*").each(function (index, element) {
+          var target = $("#scope");
+          console.log(target)
+          var offset = 0;
+          // var duration = $(this).attr("data-gt-duration");
+
+          if (target) {
+            //console.log("目標:" + target);
+            //console.log("時間:" + duration);
+            //console.log("位移:" + offset);
+
+            // 上方位置 = 目標區塊.位移().上方位置
+            var top = $(target).offset().top;
+
+            $("html").stop().animate({
+              scrollTop: top - offset
+            });
+          }
+        });
       }
 
       // 離開頁面前清除 localStorage

+ 1 - 1
themes/hugo-universal-theme-master/layouts/partials/footer.html

@@ -229,7 +229,7 @@
           <div class="tab-pane fade" id="v-pills-store" role="tabpanel" aria-labelledby="v-pills-store-tab">
             <ul>
               <li>
-                <a href="/store/">服務範圍</a>
+                <a href="/store/" onclick="setValue('scope')">服務範圍</a>
               </li>
               <li>
                 <a href="/store/" onclick="setValue('NewTaipei')">新北門市</a>