Skip to content

Commit ff19c92

Browse files
committed
feat: class Styler;to fix: About bottom figures, vert long tablet overflow
1 parent 21fc868 commit ff19c92

File tree

4 files changed

+73
-16
lines changed

4 files changed

+73
-16
lines changed

Classes/Styler.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export class Styler {
2+
pics = [];
3+
4+
fillPicsArray(className){
5+
document.querySelectorAll(className).forEach(el => {
6+
this.pics.push(el)
7+
})
8+
};
9+
10+
calcStyles(elData1,elData2,screenWidthFresh = document.documentElement.clientWidth){
11+
let wider,narrower,taller,lower;
12+
let sumOfWi = elData1.width + elData2.width;
13+
14+
if (sumOfWi > screenWidthFresh){
15+
console.log(sumOfWi, 'wader!! than', screenWidthFresh);
16+
let k1 = elData1.width / sumOfWi;
17+
let k2 = elData2.width / sumOfWi;
18+
elData1.el.style.width = `${k1 * screenWidthFresh}px`;
19+
elData2.el.style.width = `${k2 * screenWidthFresh}px`;
20+
} else console.log(sumOfWi, 'NOT wader than', screenWidthFresh)
21+
22+
};
23+
24+
getParam(stylesObj, param){
25+
return +stylesObj[param]
26+
.slice(0,stylesObj[param]
27+
.indexOf('px'));
28+
};
29+
30+
findNGive(id){
31+
let elData = {}
32+
elData.el = document.getElementById(id);
33+
elData.id = id;
34+
elData.initStyles = window.getComputedStyle(elData.el);
35+
elData.height = this.getParam(elData.initStyles,'height');
36+
elData.width = this.getParam(elData.initStyles,'width');
37+
elData.ratio = elData.width / elData.height;
38+
console.log(elData)
39+
return elData
40+
}
41+
}

Routes/About.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ export const About = {
88
<div class="About-figures" id="medievalPics">
99
<figure>
1010
<img src="./pics/Morignoni_Desenciano.jpg" alt="portrait of young tailor Morignoni Desenciano ">
11+
<!-- <img src="https://1.bp.blogspot.com/-QSd1Uh3-HDM/WJTSc3Po-lI/AAAAAAAActg/bQGmNlSDTTUvIbb8tTae2VHKQVXrXI4XwCLcB/s1600/giovanni_battista_moroni_-_the_tailor_il_tagliapanni_-_google_art_project.jpg" alt="portrait of young tailor Morignoni Desenciano ">-->
1112
<figcaption> Портрет Маринони Дезенцано, Лондон, 1525г.</figcaption>
1213
</figure>
1314
<figure>
14-
<img src="./pics/Henry_8_compressed.jpeg" alt="portrait of King Henry VIII">
15+
<img src="./pics/Henry_8.jpeg" alt="portrait of King Henry VIII">
16+
<!-- <img src="http://4.bp.blogspot.com/-rYu2nmHFoS0/VDxjMn1xzxI/AAAAAAAAAMA/QkeJqI9rJaw/s1600/henry8petworth.jpg" alt="portrait of King Henry VIII">-->
1517
<figcaption> Портрет Короля Генриха VIII, Лондон, 1528г.</figcaption>
1618
</figure>
1719
</div>
@@ -45,5 +47,21 @@ export const About = {
4547
дочерний филиал, который в дальнейшем выделится в отдельный бренд, сменит хозяина и станет известен как <a href="https://aeronauticamilitare.eu/">Aeronautica Militare</a>.
4648
4749
</p>
48-
</div>`
50+
</div>`,
51+
data(){
52+
return{
53+
}},
54+
mounted(){
55+
56+
},
57+
created(){
58+
59+
},
60+
methods:{
61+
62+
},
63+
computed:{
64+
65+
},
66+
4967
}

pics/spring.jpg

-294 KB
Binary file not shown.

styles.css

+12-14
Original file line numberDiff line numberDiff line change
@@ -628,16 +628,19 @@ footer{
628628
/*=====================about раздел========================*/
629629
/*для ПеКА*/
630630
@media screen and (min-width: 1201px) {
631-
.About-figures{
632631

632+
.About-figures { /*Див с 2мя Figures*/
633+
display:flex;
634+
flex-direction:row;
633635
}
634636

635-
.About-figures figure{
636-
637+
.About-figures figure{ /*фигура = картинка+подпись*/
638+
padding:0 10px;
637639
}
638640

639-
.About-figures img{
640-
641+
.About-whole-container img{ /*сама картинка*/
642+
width:100%;
643+
height:100%;
641644
}
642645

643646
}
@@ -666,24 +669,20 @@ footer{
666669
}
667670
/*-------------общее-------------*/
668671
.About-whole-container{ /* весь контейнер */
669-
display:flex;
670-
flex-direction:column;
672+
/*display:flex;*/
673+
/*flex-direction:column;*/
671674
}
672675

673676
.About-figures { /* ящик с 2-мя фигурами */
674-
display:flex;
675-
flex-direction: row;
676677

677678
}
678679

679680
.About-figures figure{ /* фигура - фото и подпись */
680-
display:flex;
681-
flex-direction: column;
682-
align-items: center;
681+
683682
}
684683

685684
.About-figures img{ /* фото в фигуре */
686-
width:90%;
685+
687686
}
688687

689688
.About-figures figcaption{
@@ -693,7 +692,6 @@ footer{
693692
.About-description{
694693
margin:10px 20px;
695694
text-align:left;
696-
697695
}
698696

699697
.About-description a{

0 commit comments

Comments
 (0)