Skip to content

Commit fb36d24

Browse files
committed
modified: assets/css/w3.css
modified: assets/js/componentes/card.js modified: assets/js/paginas/home.js
1 parent ecd86b1 commit fb36d24

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

assets/css/w3.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,3 +824,19 @@ input:checked + .slider:before {
824824
#star-border:hover {
825825
cursor: pointer
826826
}
827+
.aspect-ratio-box {
828+
padding-top: 56.25%;
829+
position: relative;
830+
}
831+
832+
.aspect-ratio-box img.card-img {
833+
position: absolute;
834+
top: 0;
835+
left: 0;
836+
width: 100%;
837+
height: 100%;
838+
object-fit: cover;
839+
}
840+
.cards-placeholder {
841+
min-height: 400px;
842+
}

assets/js/componentes/card.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ class Card {
1313
this.cardElement.classList.add('w3-card-4',"w3-panel","w3-leftbar", "w3-sand", "w3-third", "w3-center");
1414
this.cardElement.innerHTML = `
1515
<h2><b>${titulo}</b></h2>
16-
<img src="${imagem}" alt="${titulo}" style="width:300px; height:300px">
16+
<div class="aspect-ratio-box">
17+
<img src="${imagem}" alt="${titulo}" loading="lazy" class="card-img">
18+
</div>
1719
<div class="container">
1820
<p>${descricao}</p>
1921
<button class="toggle-content-btn w3-btn w3-border w3-block" aria-label="${this.i18nService.t('details')}">${this.i18nService.t('details')}</button>

assets/js/paginas/home.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Home {
1616
return `
1717
<h1>${this.i18nService.t('home')}</h1>
1818
${this.slides.render()}
19-
<div id="cardsContainer"></div>
19+
<div id="cardsContainer" class="cards-placeholder"></div>
2020
`;
2121
}
2222
afterRender(){

0 commit comments

Comments
 (0)