|
@@ -1,27 +1,35 @@
|
|
|
let imgSizeAuto = function(){
|
|
|
- let rateHs = [0.047,0.113,0.069,0.089,0.089,0.089];
|
|
|
- let rateWs = [0.297,0.263,0.391,0.139,0.139,0.139]
|
|
|
- let imgEles = document.getElementsByClassName('img');
|
|
|
let viewHeight = document.body.offsetHeight;
|
|
|
let viewWidth = document.body.offsetWidth;
|
|
|
+ let imgEles = document.getElementsByClassName('img');
|
|
|
let fontsize,ratefont = 0.259;
|
|
|
- for(let i = 0; i < imgEles.length; i++){
|
|
|
- if(i <= rateHs.length){
|
|
|
- let newWidth = viewWidth * rateWs[i];
|
|
|
- imgEles[i].width = newWidth;
|
|
|
- // console.log(imgEles[i].width);
|
|
|
+ if(viewWidth <= 1450){
|
|
|
+ let rateHs = [0.047,0.113,0.069,0.089,0.089,0.089];
|
|
|
+ let rateWs = [0.297,0.263,0.391,0.139,0.139,0.139]
|
|
|
+
|
|
|
+ for(let i = 0; i < imgEles.length; i++){
|
|
|
+ if(i <= rateHs.length){
|
|
|
+ let newWidth = viewWidth * rateWs[i];
|
|
|
+ imgEles[i].width = newWidth;
|
|
|
+ // console.log(imgEles[i].width);
|
|
|
+ }
|
|
|
+ if(i == 3){
|
|
|
+ fontsize = ratefont * imgEles[i].height;
|
|
|
+ console.log(fontsize);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let buttons = document.getElementsByClassName('buttons');
|
|
|
+ for(let b of buttons){
|
|
|
+ b.style.fontSize = fontsize + 'px';
|
|
|
}
|
|
|
- if(i == 3){
|
|
|
- fontsize = ratefont * imgEles[i].height;
|
|
|
- console.log(fontsize);
|
|
|
+ }else{
|
|
|
+ let buttons = document.getElementsByClassName('buttons');
|
|
|
+ for(let b of buttons){
|
|
|
+ b.style.fontSize = '22px';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let buttons = document.getElementsByClassName('buttons');
|
|
|
- for(let b of buttons){
|
|
|
- b.style.fontSize = fontsize + 'px';
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
imgSizeAuto();
|
|
|
window.onresize = imgSizeAuto;
|