Sfoglia il codice sorgente

adjust vertical and horizontal

huaisianhuang 3 anni fa
parent
commit
905841f611
1 ha cambiato i file con 16 aggiunte e 4 eliminazioni
  1. 16 4
      js/index.js

+ 16 - 4
js/index.js

@@ -1,12 +1,24 @@
  window.onload = function(){
-  if(screen.width >= 901){
+  /* if(screen.width >= 901){
       window.location.href = "https://www2.hhh.com.tw/";   
+  } */
+  if(screen.width <= 480) {
+    let height = (window.screen.width * 2) / 3;
+    console.log(height);
+    $('.sec-02 .slide-item').css('height', `${height}px`);
+    let topHeight = (window.screen.width * 30) / 131;
+    console.log(topHeight);
   }
-  let height = (window.screen.width * 2) / 3;
-  console.log(height);
-  $('.sec-02 .slide-item').css('height', `${height}px`);
 } 
 
+window.addEventListener('resize', reportWindowSize);
+
+function reportWindowSize() {
+  if(screen.width > 480) {
+    $('.sec-02 .slide-item').css('height', `130vh`);
+  }
+}
+
 $(".sec-01__slider").slick({
         dots: true,
         autoplay: false,