goto.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. // $(".popular").hide();
  2. $(document).on("click", ".article__readMore", function (event) {
  3. $('.article__contexts_cases').css('height', 'auto');
  4. $('.article__readMore').hide();
  5. });
  6. $(document).on("click", ".likeSee__state__filter--item", function (event) {
  7. // $(".CaseNews").toggle();
  8. // $(".popular").toggle();
  9. $(".likeSee__state__filter--item").removeClass('active');
  10. $(this).addClass("active");
  11. });
  12. const urlParams = new URLSearchParams(window.location.search);
  13. let id = urlParams.get('cid');
  14. console.log(id);
  15. var datahref = String(window.location.href);
  16. var datahref2 = "http://127.0.0.1:5501/cases.html/";
  17. console.log(datahref2);
  18. let posit = datahref2.indexOf("d");
  19. if (posit == -1) {
  20. console.log('沒有d');
  21. } else {
  22. console.log('有d');
  23. }
  24. function get_data() {
  25. // var desid2=String(desid);
  26. // console.log(desid2);
  27. // $("#version").val(desid);
  28. // $("#version").html(desid);
  29. $.ajax({
  30. method: "GET",
  31. // url: `json/cases-${id}.json`,
  32. // url:`json/cases.json`,
  33. url: `https://m3.hhh.com.tw:18686/gencase?id=${id}&sort=new&page=1`,
  34. dataType: "json",
  35. })
  36. .done(function (msg) {
  37. console.log(msg);
  38. let designersinfo = "";
  39. let CaseInfo = "";
  40. let CaseInfo_mb = "";
  41. let CaseTag = "";
  42. let CaseData = "";
  43. let CaseNews = "";
  44. let CasePopular = "";
  45. let CaseDetail = "";
  46. let CasePageTitle = "";
  47. let CaseImgQuantity = "";
  48. let article__contexts = "";
  49. let CaseCoverImg = "";
  50. for (let i = 0; i < msg.length; i++) {
  51. CaseCoverImg = `
  52. <div class="CaseCoverImg">
  53. <a style="text-decoration: none;" href="https://hhh.com.tw/photos/detail/${id}/" target="_blank">
  54. <img class="img-fluid" src="${msg[i].CaseCoverImg}" alt="">
  55. </a>
  56. </div>
  57. <div class="morePhotoTip">
  58. <a style="text-decoration: none; color:#fff;" href="https://hhh.com.tw/photos/detail/${id}/" target="_blank">
  59. <i class="fa fa-clone case-img-quantity" aria-hidden="true"><span class="ms-2 case-img-quantity">${msg[i].CaseImgAmount}</span></i>
  60. </a>
  61. </div>
  62. `
  63. designersinfo = `
  64. <div class="container container-width-column px-md-0">
  65. <div class="article__wrapper">
  66. <h2 class="h4">${msg[i].Casetitle}</h2>
  67. <div class="d-flex justify-content-between">
  68. <div class="small d-none d-md-block">${msg[i].CaseTeamName} | 圖片提供:${msg[i].CaseCompany}</div>
  69. <div class="small">${msg[i].CaseDate}| 人氣:${msg[i].CaseViews}</div>
  70. </div>
  71. </div>
  72. </div>`
  73. CaseInfo = `
  74. <div class="row mx-0 justify-content-around align-items-center">
  75. <div class="col-md-3 px-mx-0">
  76. <div class="info__items border-end">
  77. <div>
  78. <div class="info__items__title">風格</div>
  79. <div class="info__items--ellipse">${msg[i].CaseStyle}</div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="col-md-3 px-mx-0">
  84. <div class="info__items border-end">
  85. <div>
  86. <div class="info__items__title">格局</div>
  87. <div class="info__items--ellipse">${msg[i].CaseHouse}</div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="col-md-3 px-mx-0">
  92. <div class="info__items border-end">
  93. <div>
  94. <div class="info__items__title">坪數</div>
  95. <div class="info__items--ellipse">${msg[i].CaseSize}</div>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="col-md-3 px-mx-0">
  100. <div class="info__items">
  101. <div>
  102. <div class="info__items__title">預算</div>
  103. <div class="info__items--ellipse">${msg[i].CaseProject}</div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>`
  108. CaseInfo_mb = `
  109. <div class="row info--shadow text-center">
  110. <div class="col-6 px-0 border-sidebar mh">
  111. <div class="info__option mx-3 border-below">
  112. <div>
  113. <div class="info__items__title">風格</div>
  114. <div class="info__items info__items--ellipse">${msg[i].CaseStyle}</div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="col-6 px-0 mh">
  119. <div class="info__option mx-3 border-below">
  120. <div>
  121. <div class="info__items__title">格局</div>
  122. <div class="info__items info__items--ellipse">${msg[i].CaseHouse}</div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="col-6 px-0 mh">
  127. <div class="info__option mx-3">
  128. <div>
  129. <div class="info__items__title">坪數</div>
  130. <div class="info__items info__items--ellipse">${msg[i].CaseSize}</div>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="col-6 px-0 mh">
  135. <div class="info__option mx-3">
  136. <div>
  137. <div class="info__items__title">預算</div>
  138. <div class="info__items info__items--ellipse">${msg[i].CaseProject}</div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. `
  144. if (msg[i].Casedescription == undefined) {
  145. article__contexts = `<div></div>`
  146. } else {
  147. article__contexts = `
  148. <div><p class="article__contexts_cases">${msg[i].Casedescription}</p></div>
  149. <div class="article__readMore">
  150. <i class="fa fa-chevron-down" aria-hidden="true"></i>
  151. <a class="article__readMore__text">閱讀更多</a>
  152. <i class="fa fa-chevron-down" aria-hidden="true"></i>
  153. </div>
  154. `
  155. }
  156. for (let j = 0; j < msg[i].CaseTag.length; j++) {
  157. // console.log(msg[i].CaseTag.length);
  158. // console.log(msg[i].CaseTag[j].Tag);
  159. CaseTag += ' \
  160. <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[i].CaseTag[j].Tag + '-keyword/" class="btn btn-outline-custom rounded-0">' + msg[i].CaseTag[j].Tag + '</a> \
  161. ';
  162. }
  163. CaseData = `
  164. <h4 class="d-none d-md-block">CASE DATA</h4>
  165. <h4 class="d-block d-md-none">CASE DATA</h4>
  166. <div class="caseData__infoItems">
  167. <div class="caseData__infoItems__list">
  168. <div class="caseData__infoItems__list--lf">居住成員:</div>
  169. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataMember} </div>
  170. </div>
  171. <div class="caseData__infoItems__list">
  172. <div class="caseData__infoItems__list--lf">房屋坪數:</div>
  173. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataSize}</div>
  174. </div>
  175. <div class="caseData__infoItems__list">
  176. <div class="caseData__infoItems__list--lf">設計風格:</div>
  177. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataStyle}</div>
  178. </div>
  179. <div class="caseData__infoItems__list">
  180. <div class="caseData__infoItems__list--lf">房屋類型:</div>
  181. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataType}</div>
  182. </div>
  183. <div class="caseData__infoItems__list">
  184. <div class="caseData__infoItems__list--lf">房屋狀況:</div>
  185. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataSituation}</div>
  186. </div>
  187. <div class="caseData__infoItems__list">
  188. <div class="caseData__infoItems__list--lf">圖片提供:</div>
  189. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataImgProvide}</div>
  190. </div>
  191. <div class="caseData__infoItems__list">
  192. <div class="caseData__infoItems__list--lf">空間格局:</div>
  193. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataSpace}</div>
  194. </div>
  195. <div class="caseData__infoItems__list">
  196. <div class="caseData__infoItems__list--lf">主要建材:</div>
  197. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataMaterial}</div>
  198. </div>
  199. </div> `
  200. CaseData2 = `
  201. <div class="caseData__designerBlock h-100">
  202. <div class="caseData__designerBlock__designer d-block d-md-none">
  203. <h4>聯絡設計師</h4>
  204. <ul>
  205. <li><a itemprop="item" href="/designer-index.php?designer_id=779"
  206. target="_blank">${msg[i].CaseCompany}</a></li>
  207. <li><a itemprop="item" href="/designer-index.php?designer_id=779"
  208. target="_blank">${msg[i].CaseTeamName} 設計師</a></li>
  209. <li>免付費諮詢專線</li>
  210. <li><a href="tel:${msg[i].ContactFreeTel}" class="tel">${msg[i].ContactFreeTel}</a></li>
  211. </ul>
  212. </div>
  213. <div class="caseData__designerBlock__designer--pc d-none d-md-block">
  214. <div class="caseData__designerBlock__designer--above">
  215. <h4>聯絡設計師</h4>
  216. <ul>
  217. <li><a href="" target="_blank">${msg[i].CaseCompany}</a></li>
  218. <li><a href="" target="_blank">${msg[i].CaseTeamName} 設計師</a></li>
  219. </ul>
  220. </div>
  221. <div class="caseData__designerBlock__designer--below">
  222. <ul>
  223. <li>
  224. 免付費諮詢專線
  225. </li>
  226. <li>
  227. <a href="tel:${msg[i].ContactFreeTel}" class="tel">${msg[i].ContactFreeTel}</a>
  228. </li>
  229. </ul>
  230. </div>
  231. </div>
  232. <div class="caseData__designerBlock__avatar">
  233. <a href="">
  234. <div class="caseData__designerBlock__avatar--img"
  235. style="background-image:url(${msg[i].ContactDesignerImg});">
  236. </div>
  237. </a>
  238. </div>
  239. </div>`
  240. for (var k = 0; k < msg[i].StyleProfile.length; k++) {
  241. CaseNews +=
  242. '<div class="col-6 col-md-4 ps-0"\
  243. <div class="vue-waterfall-slot">\
  244. <div class="card">\
  245. <a href="'+ msg[i].StyleProfile[k].ProfileLink + '">\
  246. <img class="img-fluid"\
  247. src="'+ msg[i].StyleProfile[k].ProfileImg + '"\
  248. alt="幸福空間個案圖" class="card-img-top">\
  249. </a>\
  250. </div>'
  251. CaseNews += '<div class="card-body">'
  252. for (var z = 0; z < msg[i].StyleProfile[k].ProfileTag.length; z++) {
  253. // console.log(msg[i].ProfileRecently[k].ProfileTag.length)
  254. CaseNews += '\
  255. <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[i].StyleProfile[k].ProfileTag[z].Tag + '-keyword/">\
  256. '+ msg[i].StyleProfile[k].ProfileTag[z].Tag + '\
  257. </a>\
  258. ';
  259. }
  260. CaseNews += '</div></div></div></div>'
  261. };
  262. // 備份寫法
  263. // for (var k = 0; k<msg[i].DesignerProfile.length; k++) {
  264. // CaseNews +=
  265. // '<div class="col-6 col-md-4 ps-0"\
  266. // <div class="vue-waterfall-slot">\
  267. // <div class="card CaseNews-Card">\
  268. // <a href="'+ msg[i].DesignerProfile[k].ProfileLink + '">\
  269. // <img class="img-fluid"\
  270. // src="'+ msg[i].DesignerProfile[k].ProfileImg + '"\
  271. // alt="幸福空間個案圖" class="card-img-top">\
  272. // </a>\
  273. // </div>'
  274. // CaseNews += '<div class="card-body">'
  275. // for (var z = 0; z < msg[i].DesignerProfile[k].ProfileTag.length; z++) {
  276. // // console.log(msg[i].ProfileRecently[k].ProfileTag.length)
  277. // CaseNews += '\
  278. // <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[i].DesignerProfile[k].ProfileTag[z].Tag + '-keyword/">\
  279. // '+ msg[i].DesignerProfile[k].ProfileTag[z].Tag + '\
  280. // </a>\
  281. // ';
  282. // }
  283. // CaseNews += '</div></div></div></div>'
  284. // };
  285. // for (var x = 0; x < msg[i].ProfilePopularity.length; x++) {
  286. // CasePopular +=
  287. // '<div class="likeSee__rule"\
  288. // <a href="'+ msg[i].ProfilePopularity[x].ProfileLink + '">\
  289. // <div class="likeSee__bgImg">\
  290. // <img class="img-fluid" src="'+ msg[i].ProfilePopularity[x].ProfileImg + '" alt="幸福空間個案圖" class="card-img-top">\
  291. // </div>\
  292. // </a>'
  293. // CasePopular += '<div class="likeSee__tag">'
  294. // for (var y = 0; y < msg[i].ProfilePopularity[x].ProfileTag.length; y++) {
  295. // CasePopular += '\
  296. // <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[i].ProfilePopularity[x].ProfileTag[y].Tag + '-keyword/" class="likeSee__tag--item">\
  297. // '+ msg[i].ProfilePopularity[x].ProfileTag[y].Tag + '\
  298. // </a>\
  299. // ';
  300. // }
  301. // CasePopular += '</div></div>'
  302. // };
  303. // 個案細節
  304. // CaseDetail += '<div class="row px-0 mx-0">'
  305. // CaseDetail += '<div class="col-md-8 case-slick-box" style="overflow-y: hidden;"><button type="button" class="btn-close close-window d-block d-md-none mt-3 btn-close-white" style="margin-left:auto"></button><div class="img-wrapper-desktopp"><div class="CaseDetail-slick">'
  306. // // 輪播圖
  307. // for (let j = 0; j < msg[i].CaseDetail.length; j++) {
  308. // CaseDetail +=
  309. // '<div style="width: 960px;" class="CaseSlider" data-info="' + j + '"><div class="img-wrapper-desktop"><div class="swiper-zoom-container-desktop"><img src="' + msg[i].CaseDetail[j].CaseDetailImg + '" alt=""></div></div></div>'
  310. // }
  311. // CaseDetail += '</div></div></div>'
  312. // CaseDetail +=
  313. // '<div class="col-md-4" style="background-color:#fff;">\
  314. // <div class="modal-header border-0 display-pc close-window">\
  315. // <button type="button" class="btn-close"></button>\
  316. // </div>\
  317. // <div class="d-flex justify-content-start align-items-center pt-5">\
  318. // <a href="">\
  319. // <div class="contact-section-avatar me-2">\
  320. // <img class="img-fluid" src="'+ msg[i].ContactDesignerImg + '" alt="">\
  321. // </div>\
  322. // </a>\
  323. // <div class="ms-2" style="width: 100%;">\
  324. // <a href="" class="contact-section-company">\
  325. // <div>\
  326. // '+ msg[i].CaseCompany + '\
  327. // </div>\
  328. // </a>\
  329. // <div style="display: flex;" class="contact-section-detail-box mt-3">\
  330. // <div class="contact-section-detail-lf">\
  331. // <div><i aria-hidden="true" class="fa fa-phone"></i></div>\
  332. // </div>\
  333. // <div class="contact-section-detail-rt">\
  334. // <div><a href="tel:'+ msg[i].ContactFreeTel + '">免付費 ' + msg[i].ContactFreeTel + '</a></div>\
  335. // </div>\
  336. // </div>\
  337. // </div>\
  338. // </div>\
  339. // '
  340. // CaseDetail +=
  341. // '<div class="info-area-title-desktop">\
  342. // <a href="'+ msg[i].CasePageLink + '" target="_blank">\
  343. // '+ msg[i].Casetitle + '\
  344. // </a>\
  345. // </div>\
  346. // <div class="divider"></div>\
  347. // '
  348. // CaseDetail +=
  349. // '<div class="info-area-other-case-desktop py-3">\
  350. // <div class="ml-1">該個案的其他圖片(<span id="index" class="slickNumber">1</span>/'+ msg[i].CaseDetail.length + ')</div>\
  351. // <div class="other-case-desktop-items d-flex flex-wrap">\
  352. // '
  353. // for (let j = 0; j < msg[i].CaseDetail.length; j++) {
  354. // CaseDetail +=
  355. // '<div id="img-0" data-thisid=(' + j + ') class="w-20 m-1 p-1 img_all CaseOtherImg" style="cursor: pointer;" onclick="slickGoTo(' + j + ')">\
  356. // <img src=" '+ msg[i].CaseDetail[j].CaseDetailImg + '" width="70" height="70" alt="該個案的其他圖片">\
  357. // </div>'
  358. // };
  359. // CaseDetail += '</div></div>';
  360. // CaseDetail += '<div class="divider"></div>';
  361. // CaseDetail +=
  362. // '<div class="info-area-same-case-desktop py-3">\
  363. // <div class="ml-1"><span>工業風</span> 其他作品</div>\
  364. // <div class="same-case-desktop-items d-flex flex-wrap">\
  365. // '
  366. // for (let j = 0; j < msg[i].OtherStylePortfolio.length; j++) {
  367. // CaseDetail +=
  368. // '<div class="w-20 m-1 p-1 ">\
  369. // <a href="'+ msg[i].OtherStylePortfolio[j].PortfoliolLink + '">\
  370. // <img src="'+ msg[i].OtherStylePortfolio[j].PortfoliolImg + '" width="70" height="70" alt="' + msg[i].OtherStylePortfolio.PortfoliolImgAlt + '">\
  371. // </a>\
  372. // </div>'
  373. // };
  374. // CaseDetail += '</div></div>';
  375. // CaseDetail += '<div class="divider"></div>';
  376. // CaseDetail +=
  377. // '<div class="info-area-data-desktop py-3">\
  378. // <div class="ml-2">CASE DATA</div>\
  379. // <div class="data-table-desktop ml-2">\
  380. // <div class="data-table-items d-flex">\
  381. // <div class="data-table-lf">\
  382. // <div>裝潢費用:</div>\
  383. // </div>\
  384. // <div class="data-table-rt">\
  385. // <div>'+ msg[i].CaseProject + '</div>\
  386. // </div>\
  387. // </div>\
  388. // <div class="data-table-items d-flex">\
  389. // <div class="data-table-lf">\
  390. // <div>居住成員:</div>\
  391. // </div>\
  392. // <div class="data-table-rt">\
  393. // <div>'+ msg[i].CaseDataMember + '</div>\
  394. // </div>\
  395. // </div>\
  396. // <div class="data-table-items d-flex">\
  397. // <div class="data-table-lf">\
  398. // <div>設計風格:</div>\
  399. // </div>\
  400. // <div class="data-table-rt">\
  401. // <div>'+ msg[i].CaseStyle + '</div>\
  402. // </div>\
  403. // </div>\
  404. // <div class="data-table-items d-flex">\
  405. // <div class="data-table-lf">\
  406. // <div>房屋類型:</div>\
  407. // </div>\
  408. // <div class="data-table-rt">\
  409. // <div>'+ msg[i].CaseDataType + '</div>\
  410. // </div>\
  411. // </div>\
  412. // <div class="data-table-items d-flex">\
  413. // <div class="data-table-lf">\
  414. // <div>房屋坪數:</div>\
  415. // </div>\
  416. // <div class="data-table-rt">\
  417. // <div>'+ msg[i].CaseSize + '</div>\
  418. // </div>\
  419. // </div>\
  420. // <div class="data-table-items d-flex">\
  421. // <div class="data-table-lf">\
  422. // <div>房屋狀況:</div>\
  423. // </div>\
  424. // <div class="data-table-rt">\
  425. // <div>'+ msg[i].CaseDataSituation + '</div>\
  426. // </div>\
  427. // </div>\
  428. // <div class="data-table-items d-flex">\
  429. // <div class="data-table-lf">\
  430. // <div>圖片提供:</div>\
  431. // </div>\
  432. // <div class="data-table-rt">\
  433. // <div>'+ msg[i].CaseCompany + '</div>\
  434. // </div>\
  435. // </div>\
  436. // <div class="data-table-items d-flex">\
  437. // <div class="data-table-lf">\
  438. // <div>空間格局:</div>\
  439. // </div>\
  440. // <div class="data-table-rt">\
  441. // <div>'+ msg[i].CaseDataSpace + '</div>\
  442. // </div>\
  443. // </div>\
  444. // <div class="data-table-items d-flex">\
  445. // <div class="data-table-lf">\
  446. // <div>主要建材:</div>\
  447. // </div>\
  448. // <div class="data-table-rt">\
  449. // <div>'+ msg[i].CaseDataMaterial + '</div>\
  450. // </div>\
  451. // </div>\
  452. // </div>\
  453. // </div>';
  454. // CaseDetail += '<div class="divider"></div>';
  455. // CaseDetail +=
  456. // '<div class="info-area-contact-desktop py-3 mb-2">\
  457. // <div class="ml-2">聯絡資訊 Info</div>\
  458. // <div class="contact-section-desktop ml-2 mt-2">\
  459. // <div class="contact-section-detail-desktop mt-3">\
  460. // <div class="d-flex">\
  461. // <div class="contact-section-detail-lf">\
  462. // <div><i aria-hidden="true" class="fa fa-phone"></i></div>\
  463. // </div>\
  464. // <div class="contact-section-detail-rt">\
  465. // <div>\
  466. // <a href="tel:'+ msg[i].CaseCompanyTel + '">' + msg[i].CaseCompanyTel + '</a>\
  467. // </div>\
  468. // </div>\
  469. // </div>\
  470. // <div class="d-flex">\
  471. // <div class="contact-section-detail-lf">\
  472. // <div><i class="fas fa-map-marker-alt"></i></div>\
  473. // </div>\
  474. // <div class="contact-section-detail-rt">\
  475. // <div><a href="'+ msg[i].CaseCompanyMap + '" target="_blank">' + msg[i].CaseCompanyAddress + '</a></div>\
  476. // </div>\
  477. // </div>\
  478. // <div class="d-flex">\
  479. // <div class="contact-section-detail-lf">\
  480. // <div><i class="far fa-envelope"></i></div>\
  481. // </div>\
  482. // <div class="contact-section-detail-rt">\
  483. // <div><a href="mailto:'+ msg[i].CaseCompanyEmail + '">' + msg[i].CaseCompanyEmail + '</a></div>\
  484. // </div>\
  485. // </div>\
  486. // <div class="d-flex">\
  487. // <div class="contact-section-detail-lf">\
  488. // <div><i aria-hidden="true" class="fa fa-home"></i></div>\
  489. // </div>\
  490. // <div class="contact-section-detail-rt">\
  491. // <div><a href="'+ msg[i].CaseCompanyWeb + '"\
  492. // target="_blank">'+ msg[i].CaseCompanyWeb + '</a></div>\
  493. // </div>\
  494. // </div>\
  495. // </div>\
  496. // </div>\
  497. // </div>'
  498. // CaseDetail += '</div>'
  499. CasePageTitle += '' + msg[i].Casetitle + ''
  500. }
  501. $('.CaseCover_Box').html(CaseCoverImg);
  502. $('.article').html(designersinfo);
  503. $('.CaseInfo').html(CaseInfo);
  504. $('.CaseInfo_mb').html(CaseInfo_mb);
  505. $('.CaseTag').html(CaseTag);
  506. $('.caseData-PC-left').html(CaseData);
  507. $('.caseData-PC-right').html(CaseData2);
  508. $('.CaseNews-Card').html(CaseNews);
  509. // $('.Case-popular').html(CasePopular);
  510. // $('.CaseModel').html(CaseDetail);
  511. $('#case-page-title').html(CasePageTitle);
  512. $('.article__contexts-box').html(article__contexts);
  513. // $('.CaseDetail-slick').slick({
  514. // slidesToShow: 1, //預設 1 幻燈片顯示幾張
  515. // slidesToScroll: 1,//預設 1 幻灯片每次滑動幾張
  516. // arrows: true, // 預設 true 左右箭頭是否顯示
  517. // prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: white; transform: translateY(-10px);"></i></button>',
  518. // nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>'
  519. // });
  520. // var activeimg = $(".slick-active img")[0];
  521. // console.log(activeimg);
  522. // var imgwidth = activeimg.width;
  523. // var imgheight = activeimg.height;
  524. // console.log(imgwidth);
  525. // if(imgwidth < 1000 && imgwidth >imgheight)
  526. // {
  527. // console.log(activeimg.parentNode)
  528. // activeimg.parentNode.classList.add('swiper-zoom-container-sm-desktop');
  529. // }
  530. // if (imgwidth < imgheight) {
  531. // activeimg.style.width = 'auto';
  532. // }
  533. });
  534. }
  535. get_data();
  536. $('.morePhotoTip > a').attr('href', `./casedetail.html?cid=${id}`);
  537. // function slickGoTo(key) {
  538. // let slickNumber = "";
  539. // $('.CaseDetail-slick').slick('slickGoTo', key);
  540. // let slickNo = key + 1;
  541. // console.log(slickNo);
  542. // slickNumber += '' + slickNo + ''
  543. // $('.slickNumber').html(slickNumber);
  544. // }
  545. // $(document).on("click", ".slick-prev", function (event) {
  546. // let slickNumbertest = '';
  547. // console.log(desid - 1);
  548. // let slickNumber1 = desid + 1;
  549. // slickNumbertest += '' + slickNumber1 + ''
  550. // $('.slickNumber').html(slickNumbertest);
  551. // });
  552. // $(document).on("click", ".slick-next", function (event) {
  553. // var desid = $(".slick-active").data("info");
  554. // let slickNumbertest = '';
  555. // console.log(desid + 1);
  556. // let slickNumber1 = desid + 1;
  557. // slickNumbertest += '' + slickNumber1 + ''
  558. // $('.slickNumber').html(slickNumbertest);
  559. // });
  560. // $(document).on("click", ".close-window", function (event) {
  561. // window.close();
  562. // });
  563. let filter;
  564. $(".views").click(function () {
  565. filter = "hot";
  566. get_views_data();
  567. });
  568. $(".recently").click(function () {
  569. filter = "new";
  570. get_views_data();
  571. });
  572. function get_views_data() {
  573. $.ajax({
  574. method: "GET",
  575. // url: `json/cases-${id}.json`,
  576. // url:`json/cases.json`,
  577. url: `https://m3.hhh.com.tw:18686/gencase?id=${id}&sort=${filter}&page=1`,
  578. dataType: "json",
  579. })
  580. .done(function (msg) {
  581. let CaseNews = "";
  582. // if (filter == "hot") {
  583. // msg[0].StyleProfile.sort(function (a, b) {
  584. // return a['Views'] > b['Views'] ? -1 : 1;
  585. // });
  586. // }
  587. console.log(msg);
  588. console.log(msg[0].StyleProfile);
  589. for (var k = 0; k < msg[0].StyleProfile.length; k++) {
  590. CaseNews +=
  591. '<div class="col-6 col-md-4 ps-0"\
  592. <div class="vue-waterfall-slot">\
  593. <div class="card CaseNews-Card">\
  594. <a href="'+ msg[0].StyleProfile[k].ProfileLink + '">\
  595. <img class="img-fluid"\
  596. src="'+ msg[0].StyleProfile[k].ProfileImg + '"\
  597. alt="幸福空間個案圖" class="card-img-top">\
  598. </a>\
  599. </div>'
  600. CaseNews += '<div class="card-body">'
  601. for (var z = 0; z < msg[0].StyleProfile[k].ProfileTag.length; z++) {
  602. // console.log(msg[i].ProfileRecently[k].ProfileTag.length)
  603. CaseNews += '\
  604. <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[0].StyleProfile[k].ProfileTag[z].Tag + '-keyword/">\
  605. '+ msg[0].StyleProfile[k].ProfileTag[z].Tag + '\
  606. </a>\
  607. ';
  608. }
  609. CaseNews += '</div></div></div></div>'
  610. };
  611. $('.CaseNews-Card').html(CaseNews);
  612. });
  613. };
  614. if ($(".views").hasClass("active")) {
  615. filter = "hot";
  616. // alert('1')
  617. } else {
  618. filter = "new";
  619. // alert('2')
  620. }
  621. function scroll_bottom_load_data(page) {
  622. $.ajax({
  623. method: "GET",
  624. // url: `json/cases-${id}.json`,
  625. // url:`json/cases.json`,
  626. url: `https://m3.hhh.com.tw:18686/gencase?id=${id}&sort=${filter}&page=${page}`,
  627. dataType: "json",
  628. })
  629. .done(function (msg) {
  630. let CaseNews = "";
  631. for (var k = 0; k < msg[0].StyleProfile.length; k++) {
  632. CaseNews +=
  633. '<div class="col-6 col-md-4 ps-0">\
  634. <div class="vue-waterfall-slot">\
  635. <div class="card">\
  636. <a href="'+ msg[0].StyleProfile[k].ProfileLink + '">\
  637. <img class="img-fluid" src="'+ msg[0].StyleProfile[k].ProfileImg + '" alt="幸福空間個案圖" class="card-img-top">\
  638. </a>\
  639. </div>'
  640. CaseNews += '<div class="card-body">'
  641. for (var z = 0; z < msg[0].StyleProfile[k].ProfileTag.length; z++) {
  642. // console.log(msg[i].ProfileRecently[k].ProfileTag.length)
  643. CaseNews += '\
  644. <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[0].StyleProfile[k].ProfileTag[z].Tag + '-keyword/">\
  645. '+ msg[0].StyleProfile[k].ProfileTag[z].Tag + '\
  646. </a>\
  647. ';
  648. }
  649. CaseNews += '</div></div></div></div>'
  650. };
  651. $('.CaseNews-Card').append(CaseNews);
  652. });
  653. }
  654. $(window).scroll(function () {
  655. var scrollTop = $(this).scrollTop();
  656. var scrollHeight = $('body').prop("scrollHeight");
  657. //一樣 var scrollHeight2 = document.documentElement.scrollHeight;
  658. var clientHeight = document.documentElement.clientHeight;
  659. if (jQuery(window).width() < 767) {
  660. // console.log(scrollHeight);
  661. // console.log(scrollTop);
  662. //一樣 var scrollHeight2 = document.documentElement.scrollHeight;
  663. //https://stackoverflow.com/questions/10423759/plain-javascript-to-jquery-clientheight
  664. // console.log('scrollTop:', scrollTop);
  665. // console.log('scrollHeight:', scrollHeight);
  666. // console.log('clientHeight:', clientHeight);
  667. if (scrollTop + clientHeight >= scrollHeight - 5) {
  668. loadMore_m();
  669. console.log(page);
  670. }
  671. } else {
  672. // if (($(document).height() - 390) > $(window).scrollTop() + $(window).height() && $(window).scrollTop() + $(window).height() >= ($(document).height() - 400)) {
  673. // loadMore();
  674. // console.log(page);
  675. // }
  676. if (scrollTop + clientHeight >= scrollHeight - 5) {
  677. loadMore();
  678. console.log(page);
  679. }
  680. }
  681. })
  682. // $(window).scroll(function () {
  683. // var scrollTop = $(this).scrollTop();
  684. // var scrollHeight = $('body').prop("scrollHeight");
  685. // // console.log(scrollHeight);
  686. // // console.log(scrollTop);
  687. // //一樣 var scrollHeight2 = document.documentElement.scrollHeight;
  688. // var clientHeight = document.documentElement.clientHeight;
  689. // //https://stackoverflow.com/questions/10423759/plain-javascript-to-jquery-clientheight
  690. // // console.log('scrollTop:', scrollTop);
  691. // // console.log('scrollHeight:', scrollHeight);
  692. // // console.log('clientHeight:', clientHeight);
  693. // if (($(document).height() - 390) > $(window).scrollTop() + $(window).height() && $(window).scrollTop() + $(window).height() >= ($(document).height() - 400)) {
  694. // loadMore();
  695. // console.log(page);
  696. // }
  697. // })
  698. var page = 1;
  699. function loadMore() {
  700. // console.log(page);
  701. setTimeout(function () {
  702. page++;
  703. // console.log(page);
  704. scroll_bottom_load_data(page);
  705. return page
  706. }, 1000);
  707. }
  708. function loadMore_m() {
  709. // console.log(page);
  710. setTimeout(function () {
  711. page++;
  712. // console.log(page);
  713. scroll_bottom_load_data(page);
  714. return page
  715. }, 500);
  716. }
  717. //if成立 只加一次
  718. // $(document).ready(function () {
  719. // var page = 1;
  720. // $(window).scroll(function () {
  721. // let last = document.querySelector('.CaseNews-Card > div:last-child');
  722. // if ($(window).scrollTop() > last.offsetTop) {
  723. // page++
  724. // console.log(page);
  725. // // $("#click_test").trigger("click");
  726. // // scroll_bottom_load_data(page);
  727. // }
  728. // });
  729. // });
  730. // $(window).scroll(function () {
  731. // // var scrollz = $(document).scrollTop();
  732. // // console.log(scrollz);
  733. // // var scrolly = $(document).height();
  734. // // console.log(scrolly);
  735. // // var scrollx = $(window).height();
  736. // // console.log(scrollx);
  737. // if ($(window).scrollTop() + $(window).height() == $(document).height()) {
  738. // page++;
  739. // console.log(page);
  740. // scroll_bottom_load_data(page);
  741. // // alert("Reached bottom!");
  742. // }
  743. // });
  744. // $(document).ready(function () {
  745. // $('#hhh-cases').scroll(function () {
  746. // var h = $(this).height();
  747. // var sh = $(this)[0].scrollHeight;
  748. // var st = $(this)[0].scrollTop;
  749. // console.log(h);
  750. // console.log(sh);
  751. // console.log(st);
  752. // // if(h >= sh){
  753. // // alert('底部了')
  754. // // }
  755. // });
  756. // });