goto.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. // $(".popular").hide();
  2. console.log(1);
  3. $(document).ready(function () {
  4. console.log(1);
  5. $('#hhh-cases').scroll(function () {
  6. var h = $(this).height();
  7. var sh = $(this).scrollHeight;
  8. var st = $(this).scrollTop;
  9. console.log(h);
  10. console.log(sh);
  11. console.log(st);
  12. if(h+st>= sh){
  13. alert('底部了')
  14. }
  15. });
  16. });
  17. $(document).on("click", ".article__readMore", function (event) {
  18. $('.article__contexts_cases').css('height', 'auto');
  19. $('.article__readMore').hide();
  20. });
  21. $(document).on("click", ".likeSee__state__filter--item", function (event) {
  22. // $(".CaseNews").toggle();
  23. // $(".popular").toggle();
  24. $(".likeSee__state__filter--item").removeClass('active');
  25. $(this).addClass("active");
  26. });
  27. const urlParams = new URLSearchParams(window.location.search);
  28. let id = urlParams.get('cid');
  29. console.log(id);
  30. function get_data() {
  31. // var desid2=String(desid);
  32. // console.log(desid2);
  33. // $("#version").val(desid);
  34. // $("#version").html(desid);
  35. $.ajax({
  36. method: "GET",
  37. url: `json/cases-${id}.json`,
  38. // url:`json/cases.json`,
  39. dataType: "json",
  40. })
  41. .done(function (msg) {
  42. // console.log(msg);
  43. let designersinfo = "";
  44. let CaseInfo = "";
  45. let CaseInfo_mb = "";
  46. let CaseTag = "";
  47. let CaseData = "";
  48. let CaseNews = "";
  49. let CasePopular = "";
  50. let CaseDetail = "";
  51. let CasePageTitle = "";
  52. let CaseImgQuantity = "";
  53. let article__contexts = "";
  54. let CaseCoverImg = "";
  55. for (let i = 0; i < msg.length; i++) {
  56. CaseCoverImg = `
  57. <img class="img-fluid" src="${msg[i].CaseCoverImg}" alt="">
  58. `
  59. designersinfo = `
  60. <div class="container container-width-column px-md-0">
  61. <div class="article__wrapper">
  62. <h2 class="h4">${msg[i].Casetitle}</h2>
  63. <div class="d-flex justify-content-between">
  64. <div class="small d-none d-md-block">${msg[i].CaseTeamName} | 圖片提供:${msg[i].CaseCompany}</div>
  65. <div class="small">${msg[i].CaseDate}| 人氣:${msg[i].CaseViews}</div>
  66. </div>
  67. </div>
  68. </div>`
  69. CaseInfo = `
  70. <div class="row mx-0 justify-content-around align-items-center">
  71. <div class="col-md-3 px-mx-0">
  72. <div class="info__items border-end">
  73. <div>
  74. <div class="info__items__title">風格</div>
  75. <div class="info__items--ellipse">${msg[i].CaseStyle}</div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class="col-md-3 px-mx-0">
  80. <div class="info__items border-end">
  81. <div>
  82. <div class="info__items__title">格局</div>
  83. <div class="info__items--ellipse">${msg[i].CaseHouse}</div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="col-md-3 px-mx-0">
  88. <div class="info__items border-end">
  89. <div>
  90. <div class="info__items__title">坪數</div>
  91. <div class="info__items--ellipse">${msg[i].CaseSize}</div>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="col-md-3 px-mx-0">
  96. <div class="info__items">
  97. <div>
  98. <div class="info__items__title">預算</div>
  99. <div class="info__items--ellipse">${msg[i].CaseProject}</div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>`
  104. CaseInfo_mb = `
  105. <div class="row info--shadow text-center">
  106. <div class="col-6 px-0 border-sidebar mh">
  107. <div class="info__option mx-3 border-below">
  108. <div>
  109. <div class="info__items__title">風格</div>
  110. <div class="info__items info__items--ellipse">${msg[i].CaseStyle}</div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="col-6 px-0 mh">
  115. <div class="info__option mx-3 border-below">
  116. <div>
  117. <div class="info__items__title">格局</div>
  118. <div class="info__items info__items--ellipse">${msg[i].CaseHouse}</div>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="col-6 px-0 mh">
  123. <div class="info__option mx-3">
  124. <div>
  125. <div class="info__items__title">坪數</div>
  126. <div class="info__items info__items--ellipse">${msg[i].CaseSize}</div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="col-6 px-0 mh">
  131. <div class="info__option mx-3">
  132. <div>
  133. <div class="info__items__title">預算</div>
  134. <div class="info__items info__items--ellipse">${msg[i].CaseProject}</div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. `
  140. if (msg[i].Casedescription == undefined) {
  141. article__contexts = `<div></div>`
  142. } else {
  143. article__contexts = `
  144. <div><p class="article__contexts_cases">${msg[i].Casedescription}</p></div>
  145. <div class="article__readMore">
  146. <i class="fa fa-chevron-down" aria-hidden="true"></i>
  147. <a class="article__readMore__text">閱讀更多</a>
  148. <i class="fa fa-chevron-down" aria-hidden="true"></i>
  149. </div>
  150. `
  151. }
  152. for (let j = 0; j < msg[i].CaseTag.length; j++) {
  153. // console.log(msg[i].CaseTag.length);
  154. // console.log(msg[i].CaseTag[j].Tag);
  155. CaseTag += ' \
  156. <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> \
  157. ';
  158. }
  159. CaseData = `
  160. <h4 class="d-none d-md-block">CASE DATA</h4>
  161. <h4 class="d-block d-md-none">CASE DATA</h4>
  162. <div class="caseData__infoItems">
  163. <div class="caseData__infoItems__list">
  164. <div class="caseData__infoItems__list--lf">居住成員:</div>
  165. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataMember} </div>
  166. </div>
  167. <div class="caseData__infoItems__list">
  168. <div class="caseData__infoItems__list--lf">房屋坪數:</div>
  169. <div class="caseData__infoItems__list--rt">${msg[i].CaseDataSize}</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].CaseDataStyle}</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].CaseDataType}</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].CaseDataSituation}</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].CaseDataImgProvide}</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].CaseDataSpace}</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].CaseDataMaterial}</div>
  194. </div>
  195. </div> `
  196. CaseData2 = `
  197. <div class="caseData__designerBlock h-100">
  198. <div class="caseData__designerBlock__designer d-block d-md-none">
  199. <h4>聯絡設計師</h4>
  200. <ul>
  201. <li><a itemprop="item" href="/designer-index.php?designer_id=779"
  202. target="_blank">${msg[i].CaseCompany}</a></li>
  203. <li><a itemprop="item" href="/designer-index.php?designer_id=779"
  204. target="_blank">${msg[i].CaseTeamName} 設計師</a></li>
  205. <li>免付費諮詢專線</li>
  206. <li><a href="tel:${msg[i].ContactFreeTel}" class="tel">${msg[i].ContactFreeTel}</a></li>
  207. </ul>
  208. </div>
  209. <div class="caseData__designerBlock__designer--pc d-none d-md-block">
  210. <div class="caseData__designerBlock__designer--above">
  211. <h4>聯絡設計師</h4>
  212. <ul>
  213. <li><a href="" target="_blank">${msg[i].CaseCompany}</a></li>
  214. <li><a href="" target="_blank">${msg[i].CaseTeamName} 設計師</a></li>
  215. </ul>
  216. </div>
  217. <div class="caseData__designerBlock__designer--below">
  218. <ul>
  219. <li>
  220. 免付費諮詢專線
  221. </li>
  222. <li>
  223. <a href="tel:${msg[i].ContactFreeTel}" class="tel">${msg[i].ContactFreeTel}</a>
  224. </li>
  225. </ul>
  226. </div>
  227. </div>
  228. <div class="caseData__designerBlock__avatar">
  229. <a href="">
  230. <div class="caseData__designerBlock__avatar--img"
  231. style="background-image:url(${msg[i].ContactDesignerImg});">
  232. </div>
  233. </a>
  234. </div>
  235. </div>`
  236. for (var k = 0; k<msg[i].DesignerProfile.length; k++) {
  237. CaseNews +=
  238. '<div class="col-6 col-md-4 ps-0"\
  239. <div class="vue-waterfall-slot">\
  240. <div class="card CaseNews-Card">\
  241. <a href="'+ msg[i].DesignerProfile[k].ProfileLink + '">\
  242. <img class="img-fluid"\
  243. src="'+ msg[i].DesignerProfile[k].ProfileImg + '"\
  244. alt="幸福空間個案圖" class="card-img-top">\
  245. </a>\
  246. </div>'
  247. CaseNews += '<div class="card-body">'
  248. for (var z = 0; z < msg[i].DesignerProfile[k].ProfileTag.length; z++) {
  249. // console.log(msg[i].ProfileRecently[k].ProfileTag.length)
  250. CaseNews += '\
  251. <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[i].DesignerProfile[k].ProfileTag[z].Tag + '-keyword/">\
  252. '+ msg[i].DesignerProfile[k].ProfileTag[z].Tag + '\
  253. </a>\
  254. ';
  255. }
  256. CaseNews += '</div></div></div></div>'
  257. };
  258. // for (var x = 0; x < msg[i].ProfilePopularity.length; x++) {
  259. // CasePopular +=
  260. // '<div class="likeSee__rule"\
  261. // <a href="'+ msg[i].ProfilePopularity[x].ProfileLink + '">\
  262. // <div class="likeSee__bgImg">\
  263. // <img class="img-fluid" src="'+ msg[i].ProfilePopularity[x].ProfileImg + '" alt="幸福空間個案圖" class="card-img-top">\
  264. // </div>\
  265. // </a>'
  266. // CasePopular += '<div class="likeSee__tag">'
  267. // for (var y = 0; y < msg[i].ProfilePopularity[x].ProfileTag.length; y++) {
  268. // CasePopular += '\
  269. // <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[i].ProfilePopularity[x].ProfileTag[y].Tag + '-keyword/" class="likeSee__tag--item">\
  270. // '+ msg[i].ProfilePopularity[x].ProfileTag[y].Tag + '\
  271. // </a>\
  272. // ';
  273. // }
  274. // CasePopular += '</div></div>'
  275. // };
  276. // 個案細節
  277. CaseDetail += '<div class="row px-0 mx-0">'
  278. 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">'
  279. // 輪播圖
  280. for (let j = 0; j < msg[i].CaseDetail.length; j++) {
  281. CaseDetail +=
  282. '<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>'
  283. }
  284. CaseDetail += '</div></div></div>'
  285. CaseDetail +=
  286. '<div class="col-md-4" style="background-color:#fff;">\
  287. <div class="modal-header border-0 display-pc close-window">\
  288. <button type="button" class="btn-close"></button>\
  289. </div>\
  290. <div class="d-flex justify-content-start align-items-center pt-5">\
  291. <a href="">\
  292. <div class="contact-section-avatar me-2">\
  293. <img class="img-fluid" src="'+ msg[i].ContactDesignerImg + '" alt="">\
  294. </div>\
  295. </a>\
  296. <div class="ms-2" style="width: 100%;">\
  297. <a href="" class="contact-section-company">\
  298. <div>\
  299. '+ msg[i].CaseCompany + '\
  300. </div>\
  301. </a>\
  302. <div style="display: flex;" class="contact-section-detail-box mt-3">\
  303. <div class="contact-section-detail-lf">\
  304. <div><i aria-hidden="true" class="fa fa-phone"></i></div>\
  305. </div>\
  306. <div class="contact-section-detail-rt">\
  307. <div><a href="tel:'+ msg[i].ContactFreeTel + '">免付費 ' + msg[i].ContactFreeTel + '</a></div>\
  308. </div>\
  309. </div>\
  310. </div>\
  311. </div>\
  312. '
  313. CaseDetail +=
  314. '<div class="info-area-title-desktop">\
  315. <a href="'+ msg[i].CasePageLink + '" target="_blank">\
  316. '+ msg[i].Casetitle + '\
  317. </a>\
  318. </div>\
  319. <div class="divider"></div>\
  320. '
  321. CaseDetail +=
  322. '<div class="info-area-other-case-desktop py-3">\
  323. <div class="ml-1">該個案的其他圖片(<span id="index" class="slickNumber">1</span>/'+ msg[i].CaseDetail.length + ')</div>\
  324. <div class="other-case-desktop-items d-flex flex-wrap">\
  325. '
  326. for (let j = 0; j < msg[i].CaseDetail.length; j++) {
  327. CaseDetail +=
  328. '<div id="img-0" data-thisid=(' + j + ') class="w-20 m-1 p-1 img_all CaseOtherImg" style="cursor: pointer;" onclick="slickGoTo(' + j + ')">\
  329. <img src=" '+ msg[i].CaseDetail[j].CaseDetailImg + '" width="70" height="70" alt="該個案的其他圖片">\
  330. </div>'
  331. };
  332. CaseDetail += '</div></div>';
  333. CaseDetail += '<div class="divider"></div>';
  334. CaseDetail +=
  335. '<div class="info-area-same-case-desktop py-3">\
  336. <div class="ml-1"><span>工業風</span> 其他作品</div>\
  337. <div class="same-case-desktop-items d-flex flex-wrap">\
  338. '
  339. for (let j = 0; j < msg[i].OtherStylePortfolio.length; j++) {
  340. CaseDetail +=
  341. '<div class="w-20 m-1 p-1 ">\
  342. <a href="'+ msg[i].OtherStylePortfolio[j].PortfoliolLink + '">\
  343. <img src="'+ msg[i].OtherStylePortfolio[j].PortfoliolImg + '" width="70" height="70" alt="' + msg[i].OtherStylePortfolio.PortfoliolImgAlt + '">\
  344. </a>\
  345. </div>'
  346. };
  347. CaseDetail += '</div></div>';
  348. CaseDetail += '<div class="divider"></div>';
  349. CaseDetail +=
  350. '<div class="info-area-data-desktop py-3">\
  351. <div class="ml-2">CASE DATA</div>\
  352. <div class="data-table-desktop ml-2">\
  353. <div class="data-table-items d-flex">\
  354. <div class="data-table-lf">\
  355. <div>裝潢費用:</div>\
  356. </div>\
  357. <div class="data-table-rt">\
  358. <div>'+ msg[i].CaseProject + '</div>\
  359. </div>\
  360. </div>\
  361. <div class="data-table-items d-flex">\
  362. <div class="data-table-lf">\
  363. <div>居住成員:</div>\
  364. </div>\
  365. <div class="data-table-rt">\
  366. <div>'+ msg[i].CaseDataMember + '</div>\
  367. </div>\
  368. </div>\
  369. <div class="data-table-items d-flex">\
  370. <div class="data-table-lf">\
  371. <div>設計風格:</div>\
  372. </div>\
  373. <div class="data-table-rt">\
  374. <div>'+ msg[i].CaseStyle + '</div>\
  375. </div>\
  376. </div>\
  377. <div class="data-table-items d-flex">\
  378. <div class="data-table-lf">\
  379. <div>房屋類型:</div>\
  380. </div>\
  381. <div class="data-table-rt">\
  382. <div>'+ msg[i].CaseDataType + '</div>\
  383. </div>\
  384. </div>\
  385. <div class="data-table-items d-flex">\
  386. <div class="data-table-lf">\
  387. <div>房屋坪數:</div>\
  388. </div>\
  389. <div class="data-table-rt">\
  390. <div>'+ msg[i].CaseSize + '</div>\
  391. </div>\
  392. </div>\
  393. <div class="data-table-items d-flex">\
  394. <div class="data-table-lf">\
  395. <div>房屋狀況:</div>\
  396. </div>\
  397. <div class="data-table-rt">\
  398. <div>'+ msg[i].CaseDataSituation + '</div>\
  399. </div>\
  400. </div>\
  401. <div class="data-table-items d-flex">\
  402. <div class="data-table-lf">\
  403. <div>圖片提供:</div>\
  404. </div>\
  405. <div class="data-table-rt">\
  406. <div>'+ msg[i].CaseCompany + '</div>\
  407. </div>\
  408. </div>\
  409. <div class="data-table-items d-flex">\
  410. <div class="data-table-lf">\
  411. <div>空間格局:</div>\
  412. </div>\
  413. <div class="data-table-rt">\
  414. <div>'+ msg[i].CaseDataSpace + '</div>\
  415. </div>\
  416. </div>\
  417. <div class="data-table-items d-flex">\
  418. <div class="data-table-lf">\
  419. <div>主要建材:</div>\
  420. </div>\
  421. <div class="data-table-rt">\
  422. <div>'+ msg[i].CaseDataMaterial + '</div>\
  423. </div>\
  424. </div>\
  425. </div>\
  426. </div>';
  427. CaseDetail += '<div class="divider"></div>';
  428. CaseDetail +=
  429. '<div class="info-area-contact-desktop py-3 mb-2">\
  430. <div class="ml-2">聯絡資訊 Info</div>\
  431. <div class="contact-section-desktop ml-2 mt-2">\
  432. <div class="contact-section-detail-desktop mt-3">\
  433. <div class="d-flex">\
  434. <div class="contact-section-detail-lf">\
  435. <div><i aria-hidden="true" class="fa fa-phone"></i></div>\
  436. </div>\
  437. <div class="contact-section-detail-rt">\
  438. <div>\
  439. <a href="tel:'+ msg[i].CaseCompanyTel + '">' + msg[i].CaseCompanyTel + '</a>\
  440. </div>\
  441. </div>\
  442. </div>\
  443. <div class="d-flex">\
  444. <div class="contact-section-detail-lf">\
  445. <div><i class="fas fa-map-marker-alt"></i></div>\
  446. </div>\
  447. <div class="contact-section-detail-rt">\
  448. <div><a href="'+ msg[i].CaseCompanyMap + '" target="_blank">' + msg[i].CaseCompanyAddress + '</a></div>\
  449. </div>\
  450. </div>\
  451. <div class="d-flex">\
  452. <div class="contact-section-detail-lf">\
  453. <div><i class="far fa-envelope"></i></div>\
  454. </div>\
  455. <div class="contact-section-detail-rt">\
  456. <div><a href="mailto:'+ msg[i].CaseCompanyEmail + '">' + msg[i].CaseCompanyEmail + '</a></div>\
  457. </div>\
  458. </div>\
  459. <div class="d-flex">\
  460. <div class="contact-section-detail-lf">\
  461. <div><i aria-hidden="true" class="fa fa-home"></i></div>\
  462. </div>\
  463. <div class="contact-section-detail-rt">\
  464. <div><a href="'+ msg[i].CaseCompanyWeb + '"\
  465. target="_blank">'+ msg[i].CaseCompanyWeb + '</a></div>\
  466. </div>\
  467. </div>\
  468. </div>\
  469. </div>\
  470. </div>'
  471. CaseDetail += '</div>'
  472. CasePageTitle += '' + msg[i].Casetitle + ''
  473. CaseImgQuantity += '<span class="ms-2 case-img-quantity">' + msg[i].CaseDetail.length + '</span>'
  474. }
  475. $('.CaseCoverImg').html(CaseCoverImg);
  476. $('.article').html(designersinfo);
  477. $('.CaseInfo').html(CaseInfo);
  478. $('.CaseInfo_mb').html(CaseInfo_mb);
  479. $('.CaseTag').html(CaseTag);
  480. $('.caseData-PC-left').html(CaseData);
  481. $('.caseData-PC-right').html(CaseData2);
  482. $('.CaseNews-Card').html(CaseNews);
  483. // $('.Case-popular').html(CasePopular);
  484. $('.CaseModel').html(CaseDetail);
  485. $('#case-page-title').html(CasePageTitle);
  486. $('.case-img-quantity').html(CaseImgQuantity);
  487. $('.article__contexts-box').html(article__contexts);
  488. $('.CaseDetail-slick').slick({
  489. slidesToShow: 1, //預設 1 幻燈片顯示幾張
  490. slidesToScroll: 1,//預設 1 幻灯片每次滑動幾張
  491. arrows: true, // 預設 true 左右箭頭是否顯示
  492. prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: white; transform: translateY(-10px);"></i></button>',
  493. nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>'
  494. });
  495. var activeimg = $(".slick-active img")[0];
  496. console.log(activeimg);
  497. var imgwidth = activeimg.width;
  498. var imgheight = activeimg.height;
  499. console.log(imgwidth);
  500. // if(imgwidth < 1000 && imgwidth >imgheight)
  501. // {
  502. // console.log(activeimg.parentNode)
  503. // activeimg.parentNode.classList.add('swiper-zoom-container-sm-desktop');
  504. // }
  505. if (imgwidth < imgheight) {
  506. activeimg.style.width = 'auto';
  507. }
  508. });
  509. }
  510. get_data();
  511. $('.morePhotoTip > a').attr('href', `./casedetail.html?cid=${id}`);
  512. function slickGoTo(key) {
  513. let slickNumber = "";
  514. $('.CaseDetail-slick').slick('slickGoTo', key);
  515. let slickNo = key + 1;
  516. console.log(slickNo);
  517. slickNumber += '' + slickNo + ''
  518. $('.slickNumber').html(slickNumber);
  519. }
  520. $(document).on("click", ".slick-prev", function (event) {
  521. let slickNumbertest = '';
  522. console.log(desid - 1);
  523. let slickNumber1 = desid + 1;
  524. slickNumbertest += '' + slickNumber1 + ''
  525. $('.slickNumber').html(slickNumbertest);
  526. });
  527. $(document).on("click", ".slick-next", function (event) {
  528. var desid = $(".slick-active").data("info");
  529. let slickNumbertest = '';
  530. console.log(desid + 1);
  531. let slickNumber1 = desid + 1;
  532. slickNumbertest += '' + slickNumber1 + ''
  533. $('.slickNumber').html(slickNumbertest);
  534. });
  535. $(document).on("click", ".close-window", function (event) {
  536. window.close();
  537. });
  538. $( ".views" ).click(function() {
  539. get_views_data();
  540. });
  541. $( ".recently" ).click(function() {
  542. get_data();
  543. });
  544. function get_views_data() {
  545. $.ajax({
  546. method: "GET",
  547. url: `json/cases-${id}.json`,
  548. // url:`json/cases.json`,
  549. dataType: "json",
  550. })
  551. .done(function (msg) {
  552. console.log(msg);
  553. let CaseNews = "";
  554. msg[0].DesignerProfile.sort(function (a,b){
  555. return a['Views'] > b['Views']? -1:1;
  556. });
  557. console.log(msg[0].DesignerProfile);
  558. for (var k = 0; k < msg[0].DesignerProfile.length; k++) {
  559. CaseNews +=
  560. '<div class="col-6 col-md-4 ps-0" >\
  561. <div class="vue-waterfall-slot">\
  562. <div class="card CaseNews-Card">\
  563. <a href="'+ msg[0].DesignerProfile[k].ProfileLink + '">\
  564. <img class="img-fluid"\
  565. src="'+ msg[0].DesignerProfile[k].ProfileImg + '"\
  566. alt="幸福空間個案圖" class="card-img-top">\
  567. </a>\
  568. </div>'
  569. CaseNews += '<div class="card-body">'
  570. for (var z = 0; z < msg[0].DesignerProfile[k].ProfileTag.length; z++) {
  571. // console.log(msg[i].ProfileRecently[k].ProfileTag.length)
  572. CaseNews += '\
  573. <a target="_blank" href="https://hhh.com.tw/cases/lists/' + msg[0].DesignerProfile[k].ProfileTag[z].Tag + '-keyword/">\
  574. '+ msg[0].DesignerProfile[k].ProfileTag[z].Tag + '\
  575. </a>\
  576. ';
  577. }
  578. CaseNews += '</div></div></div></div>'
  579. };
  580. $('.CaseNews-Card').html(CaseNews);
  581. });
  582. };
  583. // $(document).ready(function () {
  584. // $('#hhh-cases').scroll(function () {
  585. // var h = $(this).height();
  586. // var sh = $(this)[0].scrollHeight;
  587. // var st = $(this)[0].scrollTop;
  588. // console.log(h);
  589. // console.log(sh);
  590. // console.log(st);
  591. // // if(h >= sh){
  592. // // alert('底部了')
  593. // // }
  594. // });
  595. // });