goto2.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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"><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"><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"><span style="color:#8DC21F" class="fw-bold fs-2">|</span>聯絡設計師 contact</h1>\
  95. <table class="table text-white">\
  96. <tbody>\
  97. <tr>\
  98. <td class="w-75">\
  99. <span>免付費電話/</span> '+ msg[i].TollFreeCall + '\
  100. </td>\
  101. </tr>\
  102. <tr>\
  103. <td>\
  104. <span>電話/</span>'+ msg[i].Telephone + '\
  105. </td>\
  106. </tr>\
  107. <tr>\
  108. <td>\
  109. <span>地址/</span>'+ msg[i].Address + '\
  110. </td>\
  111. </tr>\
  112. <tr>\
  113. <td>\
  114. <span>傳真/</span>'+ msg[i].Fax + '\
  115. </td>\
  116. </tr>\
  117. <tr>\
  118. <td>\
  119. <span>電子郵件/</span><a target="_blank" href="mailto:'+ msg[i].Email + '">' + msg[i].Email + '</a>\
  120. </td>\
  121. </tr>\
  122. <tr>\
  123. <td>\
  124. <span>網站/</span><a target="_blank" href="'+ msg[i].Web + '">' + msg[i].Web + '</a>\
  125. </td>\
  126. </tr>\
  127. <tr>\
  128. <td>\
  129. <span>Facebook:</span><a target="_blank" href="'+ msg[i].Facebook + '">' + msg[i].Facebook + '</a>\
  130. </td>\
  131. </tr>\
  132. </tbody>\
  133. </table>\
  134. </div>\
  135. </div >';
  136. aboutInt += ' \
  137. <div class="banner-des row vertical align-items-end">\
  138. <div class="banner-3 col-2 pe-0">\
  139. <img class="img-fluid" src="'+ msg[i].Designerimg + '" alt="">\
  140. </div>\
  141. <div class="banner-0 col-9 text-white">\
  142. <div class="row">\
  143. <div class="banner-1 col-9 align-self-end">\
  144. <div style="font-weight: 900;" class="fs-2">'+ msg[i].WorkName + '</div>\
  145. <p><span class="fs-5">'+ msg[i].DesignerName + '</span>設計師</p>\
  146. </div>\
  147. <div class="banner-2 col-3 row justify-content-end px-0">\
  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">\
  161. <div class="banner1-1 pt-3 pb-5" style="font-weight: 900;">'+ msg[i].WorkName + '</div>\
  162. <p class="mb-0"><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. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/arrow.png" alt=""></div></a>\
  173. </div>\
  174. </div>';
  175. }
  176. var j =0;
  177. if (msg[i].workVideo[j]==undefined) {
  178. aboutViedeo += ' \
  179. <div id="sec05" class="sec05-row row align-items-center h-100 w-100" style=" background: rgba(0, 0, 0, 0.8);text-align: center;">\
  180. <div style="padding:20vw 0px">\
  181. <h1 class="align-self-center" style="color:#86B81D;">Stay tuned !</h1>\
  182. <p class="align-self-center" style="color:#fff; letter-spacing: 5px;">...敬請期待...</p>\
  183. </div>\
  184. </div>';
  185. } else {
  186. for (var j = 0; j < msg[i].workVideo.length; j++) {
  187. aboutViedeo += ' \
  188. <div class="secimg col-lg-3 p-0">\
  189. <a target="_blank" href="'+ msg[i].workVideo[j].videoSrc + '"><img class="img-fluid" src="' + msg[i].workVideo[j].video + '" alt=""></a>\
  190. <div class="sec03-p-m p-1 mt-1 text-center">\
  191. <p class="mb-1">'+ msg[i].workVideo[j].videotext + '</p>\
  192. <a target="_blank" href="'+ msg[i].workVideo[j].videoSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/play.png" alt=""></div></a>\
  193. </div>\
  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 mx-0 w-100" 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. <a target="_blank" href="'+ msg[i].workimg[j].workSrc + '"><div class="sec03-img-m1"><img class="play1" src="../img/arrow.png" alt=""></div></a>\
  214. </div>\
  215. </div>';
  216. }
  217. }
  218. bodyBannerDes += ' \
  219. <img class="banner-img" id="img_id" src="'+ msg[i].workimg[0].img + '" alt="">\
  220. ';
  221. webtitle += ' \
  222. 幸福空間::: 2021 觀眾最愛設計師 | 滿足你期待回家的夢想推手|'+ msg[i].DesignerName +'設計師\
  223. ';
  224. $('.sec03-1').html(aboutViedeo);
  225. $('.sec02-1').html(aboutImg);
  226. $('.banner-des-about').html(aboutInt);
  227. $('.sec01').html(aboutContent);
  228. $('.sec04-1').html(aboutMethod);
  229. $('.banner-m').html(aboutIntPhone);
  230. $('#bannerdes-img').html(bodyBannerDes);
  231. $('#webtitle').html(webtitle);
  232. }
  233. }
  234. });
  235. }
  236. get_data();
  237. });
  238. $(".arrow").hide();
  239. $(window).scroll(function () {
  240. var y1 = window.scrollY;
  241. if (y1> 100) {
  242. $(".arrow").show();
  243. } else {
  244. $(".arrow").hide();
  245. }
  246. });
  247. // $(window).scroll(function () {
  248. // var y = window.scrollY;
  249. // if (y > 550) {
  250. // $(".nav").addClass("sfixed");
  251. // } else {
  252. // $(".nav").removeClass("sfixed");
  253. // }
  254. // });
  255. if (jQuery(window).width() < 767) {
  256. $(window).scroll(function () {
  257. var y = window.scrollY;
  258. if (y > 550) {
  259. $(".nav").css({"position":"fixed","top":"38px","z-index":"10"});
  260. } else {
  261. $(".nav").css({"position":"static"});
  262. }
  263. });
  264. }
  265. // $(document).ready(function(){
  266. // $(window).resize(function() {
  267. // wdth=$(window).width();
  268. // console.log(wdth)
  269. // });
  270. // });
  271. $("*").each(function (index, element) {
  272. // 此元素被點選後執行
  273. $(this).click(function (e) {
  274. // 取得被點選元素的屬性:data-gt-target
  275. var target = $(this).attr("data-gt-target");
  276. var duration = $(this).attr("data-gt-duration");
  277. var offset = $(this).attr("data-gt-offset");
  278. // JS 語法:判斷式
  279. // if (條件) {程式區塊}
  280. // 當條件成立,會執行程式區塊
  281. // 如果 目標有資料 才會執行 { } 內的程式
  282. // 避免出現 undefine (未定義 - 不存在的資料)
  283. if (target) {
  284. //console.log("目標:" + target);
  285. //console.log("時間:" + duration);
  286. //console.log("位移:" + offset);
  287. // 上方位置 = 目標區塊.位移().上方位置
  288. var top = $(target).offset().top;
  289. //console.log("要前往元素的上方位置:" + top);
  290. // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
  291. // parseInt() 將文字轉為數字
  292. $("html").stop().animate({
  293. scrollTop: top - offset
  294. }, parseInt(duration));
  295. }
  296. });
  297. });
  298. // 避免動畫與使用者滾輪衝突
  299. // html 在滾動滾輪時 停止 html 所有效果
  300. $("html").on("mousewheel", function () {
  301. $("html").stop();
  302. });