goto2.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. function getParameterByName(name, url = window.location.href) {
  2. name = name.replace(/[\[\]]/g, '\\$&');
  3. var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
  4. results = regex.exec(url);
  5. if (!results) return null;
  6. if (!results[2]) return '';
  7. return decodeURIComponent(results[2].replace(/\+/g, ' '));
  8. }
  9. $(document).ready(function () {
  10. var id = getParameterByName('id');
  11. console.log(id);
  12. function get_data() {
  13. $.ajax({
  14. method: "GET",
  15. url: "../designer4.json",
  16. dataType: "json",
  17. })
  18. .done(function (msg) {
  19. for (var i = 0; i < msg.length; i++) {
  20. if (msg[i].id == id) {
  21. var aboutContent = '';
  22. var aboutInt = '';
  23. var aboutImg = '';
  24. var aboutViedeo = '';
  25. var aboutMethod = '';
  26. var aboutIntPhone = '';
  27. var bodyBannerDes = '';
  28. var webtitle='';
  29. console.log(msg[i]);
  30. // var res = msg.length;
  31. // console.log(res);
  32. // const limit = res;
  33. // 公司簡介
  34. aboutContent += ' \
  35. <div class="row px-0 mx-0">\
  36. <div class="condition col-12 col-lg-4 bg-white">\
  37. <h1 class="fs-3 pb-3"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>接案條件 condition</h1>\
  38. <table class="table">\
  39. <tbody>\
  40. <tr>\
  41. <th class="w-25" scope="row">接案區域</th>\
  42. <td>\
  43. '+ msg[i].WorkLoc + '\
  44. </td>\
  45. </tr>\
  46. <tr>\
  47. <th scope="row">接案類型</th>\
  48. <td>\
  49. '+ msg[i].WorkType + '\
  50. </td>\
  51. </tr>\
  52. <tr>\
  53. <th scope="row">接案風格</th>\
  54. <td>\
  55. '+ msg[i].WorkStyle + '\
  56. </td>\
  57. </tr>\
  58. <tr>\
  59. <th scope="row">接案預算</th>\
  60. <td>\
  61. '+ msg[i].WorkBudget + '\
  62. </td>\
  63. </tr>\
  64. <tr>\
  65. <th scope="row">接案坪數</th>\
  66. <td>\
  67. '+ msg[i].WorkSize + '\
  68. </td>\
  69. </tr>\
  70. <tr>\
  71. <th scope="row">特殊接案</th>\
  72. <td>\
  73. '+ msg[i].WorkSoho + '\
  74. </td>\
  75. </tr>\
  76. </tbody >\
  77. </table >\
  78. </div >\
  79. <div style="background: url(../img/about/sec01/idea.webp); background-size: cover; background-repeat: no-repeat;"\
  80. class="idea col-12 col-lg-4 text-white">\
  81. <h1 class="fs-3 pb-3"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>設計理念 idea</h1>\
  82. <table class="table table-borderless text-white">\
  83. <tbody>\
  84. <tr>\
  85. <td>\
  86. '+ msg[i].DesignIdea1 + '\
  87. </td>\
  88. </tr>\
  89. </tbody>\
  90. </table>\
  91. </div>\
  92. <div style="background: url(../img/about/sec01/contact.webp); background-size: cover; background-repeat: no-repeat;"\
  93. class="contact col-12 col-lg-4 text-white">\
  94. <h1 class="fs-3 pb-3"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>聯絡設計師 contact</h1>\
  95. <table class="table text-white">\
  96. <tbody>\
  97. <tr>\
  98. <th scope="row" class="">免付費電話/</th>\
  99. <td class="">\
  100. <a target="_blank" href="tel: '+ msg[i].TollFreeCall + '"> '+ msg[i].TollFreeCall + '</a>\
  101. </td>\
  102. </tr>\
  103. <tr>\
  104. <th scope="row" class="">電.&emsp;&emsp;&ensp;話/</th>\
  105. <td>\
  106. '+ msg[i].Telephone + '\
  107. </td>\
  108. </tr>\
  109. <tr>\
  110. <th scope="row" class="">地.&emsp;&emsp;&ensp;址/</th>\
  111. <td>\
  112. '+ msg[i].Address + '\
  113. </td>\
  114. </tr>\
  115. <tr>\
  116. <th scope="row" class="">傳.&emsp;&emsp;&ensp;真/</th>\
  117. <td>\
  118. '+ msg[i].Fax + '\
  119. </td>\
  120. </tr>\
  121. <tr>\
  122. <th scope="row" class="">電&thinsp;子&thinsp;郵&thinsp;件/</th>\
  123. <td>\
  124. <a target="_blank" href="mailto:'+ msg[i].Email + '">' + msg[i].Email + '</a>\
  125. </td>\
  126. </tr>\
  127. <tr>\
  128. <th scope="row" class="">網.&emsp;&emsp;&ensp;站/</th>\
  129. <td>\
  130. <a target="_blank" href="'+ msg[i].Web + '">' + msg[i].Web + '</a>\
  131. </td>\
  132. </tr>\
  133. <tr>\
  134. <th scope="row" class="">Facebook:</th>\
  135. <td>\
  136. <a target="_blank" href="'+ msg[i].Facebook + '">' + msg[i].Facebook + '</a>\
  137. </td>\
  138. </tr>\
  139. </tbody>\
  140. </table>\
  141. </div>\
  142. </div >';
  143. aboutInt += ' \
  144. <div class="banner-des row vertical align-items-end">\
  145. <div class="banner-3 col-2 pe-0">\
  146. <img class="img-fluid" src="'+ msg[i].Designerimg + '" alt="">\
  147. </div>\
  148. <div class="banner-0 col-9 text-white">\
  149. <div class="row">\
  150. <div class="banner-1 col-9 align-self-end pb-3">\
  151. <div style="font-weight: 900;" class="fs-2">'+ msg[i].WorkName + '</div>\
  152. <p><span class="fs-5">'+ msg[i].DesignerName + '</span>設計師</p>\
  153. <button type="button" class="btn border border-white"><a target="_blank" href="tel: '+ msg[i].TollFreeCall + '"><img class="" src="../img/phone.png" alt=""></a>\</button>\
  154. <button type="button" class="btn border border-white" data-bs-toggle="modal" data-bs-target="#exampleModal">私訊</button>\
  155. </div>\
  156. <div class="banner-2 col-3 row justify-content-end px-0">\
  157. </div>\
  158. </div>\
  159. </div> \
  160. </div>';
  161. aboutIntPhone += ' \
  162. <div class="banner-m row vertical align-items-end px-0 mx-0">\
  163. <div class="bannerm-0 col-12 my-5 px-0">\
  164. <a href="../index.html"><img class="img-fluid" src="../img/banner/banner-mobile.png" alt=""></a>\
  165. </div>\
  166. <div class="bannerm-2 col-7 order-2 col-lg-2 order-3 px-0 mx-0">\
  167. <img class="img-fluid" src="'+ msg[i].Designerimg + '" alt="">\
  168. </div>\
  169. <div class="bannerm-1 col-5 order-3 col-lg-5 order-2 text-white text-start pb-3">\
  170. <div class="banner1-1 pt-3 pb-1" style="font-weight: 900;">'+ msg[i].WorkName + '</div>\
  171. <p class=""><span class="fs-5">'+ msg[i].DesignerName + '</span>設計師</p>\
  172. <button type="button" class="btn border border-white"><a target="_blank" href="tel: '+ msg[i].TollFreeCall + '"><img class="" src="../img/phone.png" alt=""></a>\</button>\
  173. <button type="button" class="btn border border-white" data-bs-toggle="modal" data-bs-target="#exampleModal">私訊</button>\
  174. </div>\
  175. </div>';
  176. for (var j = 0; j < msg[i].workimg.length; j++) {
  177. aboutImg += ' \
  178. <div class="secimg col-lg-4 mx-0 px-0">\
  179. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><img class="img-fluid" src="' + msg[i].workimg[j].img + '" alt=""></a>\
  180. <div class="sec02-p-m p-1 mt-1 text-center">\
  181. <p>'+ msg[i].workimg[j].text + '</p>\
  182. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/arrow.png" alt=""></div></a>\
  183. </div>\
  184. </div>';
  185. }
  186. var j =0;
  187. if (msg[i].workVideo[j]==undefined) {
  188. aboutViedeo += ' \
  189. <div id="sec05" class="sec05-row row align-items-center h-100 mx-0 w-100 px-0" style=" background: rgba(0, 0, 0, 0.8);text-align: center;">\
  190. <div style="padding:20vw 0px">\
  191. <h1 class="align-self-center" style="color:#86B81D;">Stay tuned !</h1>\
  192. <p class="align-self-center" style="color:#fff; letter-spacing: 5px;">...敬請期待...</p>\
  193. </div>\
  194. </div>';
  195. } else {
  196. for (var j = 0; j < msg[i].workVideo.length; j++) {
  197. aboutViedeo += ' \
  198. <div class="secimg col-lg-4 p-0">\
  199. <a target="_blank" href="'+ msg[i].workVideo[j].videoSrc + '"><img class="img-fluid" src="' + msg[i].workVideo[j].video + '" alt=""></a>\
  200. <div class="sec03-p-m p-1 mt-1 text-center">\
  201. <p class="mb-1">'+ msg[i].workVideo[j].videotext + '</p>\
  202. <a target="_blank" href="'+ msg[i].workVideo[j].videoSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/play.png" alt=""></div></a>\
  203. </div>\
  204. </div>';
  205. }
  206. }
  207. var j =0;
  208. if (msg[i].workMethod[j]==undefined) {
  209. aboutMethod += ' \
  210. <div id="sec05" class="sec05-row row align-items-center h-100 mx-0 w-100 px-0" style=" background: rgba(0, 0, 0, 0.8);text-align: center;">\
  211. <div style="padding:20vw 0px">\
  212. <h1 class="align-self-center" style="color:#86B81D;">Stay tuned !</h1>\
  213. <p class="align-self-center" style="color:#fff; letter-spacing: 5px;">...敬請期待...</p>\
  214. </div>\
  215. </div>';
  216. } else {
  217. for (var j = 0; j < msg[i].workMethod.length; j++) {
  218. aboutMethod += ' \
  219. <div class="secimg col-lg-4 p-0">\
  220. <a target="_blank" href="'+ msg[i].workMethod[j].Methodsrc + '"><img class="img-fluid" src="' + msg[i].workMethod[j].Methodimg + '" alt=""></a>\
  221. <div class="sec04-p-m p-1 mt-1 text-center">\
  222. <p>'+ msg[i].workMethod[j].Methodtext + '</p>\
  223. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/arrow.png" alt=""></div></a>\
  224. </div>\
  225. </div>';
  226. }
  227. }
  228. bodyBannerDes += ' \
  229. <img class="banner-img" id="img_id" src="'+ msg[i].workimg[0].img + '" alt="">\
  230. ';
  231. webtitle += ' \
  232. 幸福空間::: 2022 觀眾最愛設計師 | 滿足你期待回家的夢想推手|'+ msg[i].DesignerName +'設計師\
  233. ';
  234. $('.sec03-1').html(aboutViedeo);
  235. $('.sec02-1').html(aboutImg);
  236. $('.banner-des-about').html(aboutInt);
  237. $('.sec01').html(aboutContent);
  238. $('.sec04-1').html(aboutMethod);
  239. $('.banner-m').html(aboutIntPhone);
  240. $('#bannerdes-img').html(bodyBannerDes);
  241. $('#webtitle').html(webtitle);
  242. }
  243. }
  244. });
  245. }
  246. get_data();
  247. });
  248. $(".arrow").hide();
  249. $(window).scroll(function () {
  250. var y1 = window.scrollY;
  251. if (y1> 100) {
  252. $(".arrow").show();
  253. } else {
  254. $(".arrow").hide();
  255. }
  256. });
  257. // $(window).scroll(function () {
  258. // var y = window.scrollY;
  259. // if (y > 550) {
  260. // $(".nav").addClass("sfixed");
  261. // } else {
  262. // $(".nav").removeClass("sfixed");
  263. // }
  264. // });
  265. if (jQuery(window).width() < 767) {
  266. $(window).scroll(function () {
  267. var y = window.scrollY;
  268. if (y > 550) {
  269. $(".nav").css({"position":"fixed","top":"38px","z-index":"10"});
  270. } else {
  271. $(".nav").css({"position":"static"});
  272. }
  273. });
  274. }
  275. // $(document).ready(function(){
  276. // $(window).resize(function() {
  277. // wdth=$(window).width();
  278. // console.log(wdth)
  279. // });
  280. // });
  281. $("*").each(function (index, element) {
  282. // 此元素被點選後執行
  283. $(this).click(function (e) {
  284. // 取得被點選元素的屬性:data-gt-target
  285. var target = $(this).attr("data-gt-target");
  286. var duration = $(this).attr("data-gt-duration");
  287. var offset = $(this).attr("data-gt-offset");
  288. // JS 語法:判斷式
  289. // if (條件) {程式區塊}
  290. // 當條件成立,會執行程式區塊
  291. // 如果 目標有資料 才會執行 { } 內的程式
  292. // 避免出現 undefine (未定義 - 不存在的資料)
  293. if (target) {
  294. //console.log("目標:" + target);
  295. //console.log("時間:" + duration);
  296. //console.log("位移:" + offset);
  297. // 上方位置 = 目標區塊.位移().上方位置
  298. var top = $(target).offset().top;
  299. //console.log("要前往元素的上方位置:" + top);
  300. // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
  301. // parseInt() 將文字轉為數字
  302. $("html").stop().animate({
  303. scrollTop: top - offset
  304. }, parseInt(duration));
  305. }
  306. });
  307. });
  308. // 避免動畫與使用者滾輪衝突
  309. // html 在滾動滾輪時 停止 html 所有效果
  310. $("html").on("mousewheel", function () {
  311. $("html").stop();
  312. });