bhouse.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. $(".responsive").slick({
  2. dots: true,
  3. slidesToShow: 1,
  4. slidesToScroll: 1,
  5. autoplay: true,
  6. autoplaySpeed: 3000,
  7. arrows: false,
  8. });
  9. // 直式輪播圖動態更改高度
  10. function changeHeight() {
  11. let firstImg = $('.style_house_sec02_slide div:first-child img');
  12. let firstImgHeight = firstImg.css('height');
  13. $('.style_house_sec02_slide .vertical-img').css("height", `${firstImgHeight}`)
  14. }
  15. changeHeight();
  16. $(window).resize(function () {
  17. setTimeout(() => {
  18. changeHeight();
  19. }, 500)
  20. });
  21. $('.slide_single_img').each(function () { // jquery.each() 循環讀取所有圖片
  22. var height = $(this).height();
  23. var width = $(this).width();
  24. console.log(height)
  25. console.log(width)
  26. let x = (height / width)
  27. console.log(x)
  28. if (x > 1) {
  29. $(this).css({
  30. 'height': 500 + 'px',
  31. "margin": 'auto',
  32. });
  33. } else {
  34. }
  35. });
  36. $('.slide_img').each(function () { // jquery.each() 循環讀取所有圖片
  37. var height = $(this).height();
  38. var width = $(this).width();
  39. console.log(height)
  40. console.log(width)
  41. let x = (height / width)
  42. console.log(x)
  43. if (x > 1) {
  44. $(this).css({
  45. 'width': 100 + 'px',
  46. "margin": 'auto',
  47. "padding": "0px",
  48. });
  49. } else {
  50. $(this).css({
  51. "margin-top": '30px',
  52. "padding": "5px",
  53. });
  54. }
  55. });
  56. $('.style_house_sec02 .slider-for').slick({
  57. slidesToShow: 1,
  58. slidesToScroll: 1,
  59. arrows: false,
  60. fade: true,
  61. asNavFor: '.slider-nav'
  62. });
  63. $('.style_house_sec02 .slider-nav').slick({
  64. slidesToShow: 5,
  65. slidesToScroll: 3,
  66. asNavFor: '.slider-for',
  67. dots: false,
  68. arrows: false,
  69. // centerMode: true,
  70. focusOnSelect: true
  71. });
  72. $(document).on("click", ".article__readMore", function (event) {
  73. $('.bhouseweb_loc_sec02').css('height', 'auto');
  74. $('.article__readMore').hide();
  75. });
  76. $(document).on("click", ".bhouseweb_loc_type>a", function (event) {
  77. $(this).siblings().removeClass('select');
  78. $(this).toggleClass("select");
  79. });
  80. $(".bt_slogan_portfolio").click(function () {
  81. $(".bt_slogan_portfolio").fadeOut();
  82. });
  83. $(".bt_slogan").click(function () {
  84. $(".bt_slogan_portfolio").fadeIn();
  85. });
  86. // Navbar Icon
  87. function changeIcon(e) {
  88. const item = document.querySelector('[data-toggle-class]');
  89. item.className === "close-btn" ? item.className = "navbar-toggler-icon" : item.className = "close-btn";
  90. }
  91. $('.furniture_design_content .slider-for').slick({
  92. slidesToShow: 1,
  93. slidesToScroll: 1,
  94. arrows: false,
  95. fade: true,
  96. asNavFor: '.slider-nav'
  97. });
  98. $('.furniture_design_content .slider-nav').slick({
  99. slidesToShow: 3,
  100. slidesToScroll: 1,
  101. asNavFor: '.slider-for',
  102. focusOnSelect: true
  103. });