goto2.js 15 KB

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