Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Sm1pleScr1pt committed Dec 8, 2024
2 parents ccbb2d9 + 6d8cfb9 commit 56e8815
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 45 deletions.
14 changes: 14 additions & 0 deletions blocks/cards/support-contact-us-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,22 @@
object-fit: fill;
}

.section.contact-us-card-wrapper .cards-wrapper .cards ul li .cards-card-body>p:last-child:has(span img){
display: block;
width: 80px;
height: 80px;
}

.section.contact-us-card-wrapper .cards-wrapper .cards ul li .cards-card-body>p:has(span img):last-child span img {
width: 80px;
height: 80px;
display: block;
background-size: contain;
object-fit: fill;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}

@media screen and (min-width:768px) and (max-width:1200px) {
Expand Down Expand Up @@ -199,6 +209,10 @@
align-self: center;
}

.section.contact-us-card-wrapper .cards-wrapper .cards ul li .cards-card-body>p:last-child:has(span img) {
display: none;
}

.section.contact-us-card-wrapper .cards-wrapper .cards ul li .cards-card-body>p span img {
width: 40px;
height: 40px;
Expand Down
20 changes: 12 additions & 8 deletions blocks/teaser/teaser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
applyLoanNow, bannerClick, ctaClickInteraction, readMoreInteraction,
} from '../../dl.js';
import { targetObject } from '../../scripts/scripts.js';
import { targetObject , handleOpenFormOnClick } from '../../scripts/scripts.js';

export function decorateButtons(...buttons) {
return buttons
Expand Down Expand Up @@ -76,28 +76,28 @@ export function generateTeaserDOM(props, classes) {
<div class='foreground'>
<div class='text'>
${eyebrow.textContent.trim() !== ''
? `<div class='eyebrow'>${eyebrow.textContent.trim()}</div>`
: ''
}
? `<div class='eyebrow'>${eyebrow.textContent.trim()}</div>`
: ''
}
<div class='title'>${title.innerHTML}</div>
<div class='long-description'>${longDescr.innerHTML}</div>
<!-- <div class='short-description'>${hasShortDescr ? shortDescr.innerHTML : longDescr.innerHTML
}</div>-->
}</div>-->
<div class='short-description'>${shortDescr.innerHTML}</div>
<div class='cta-image-wrapper'>
<div class="img-with-text-wrap">
<div class="cta-image">${ctaImageAnchor ? ctaImageAnchor.outerHTML : ''
}</div>
}</div>
<p class="cta-text">${imageText.innerText}</p>
</div>
<div class="img-with-text-wrap">
<div class="cta-image">${ctaImageAnchor2 ? ctaImageAnchor2.outerHTML : ''
}</div>
}</div>
<p class="cta-text">${imageText2.innerText}</p>
</div>
<div class="img-with-text-wrap">
<div class="cta-image">${ctaImageAnchor3 ? ctaImageAnchor3.outerHTML : ''
}</div>
}</div>
<p class="cta-text">${imageText3.innerText}</p>
</div>
</div>
Expand Down Expand Up @@ -126,6 +126,10 @@ export function generateTeaserDOM(props, classes) {
if (index || e.target.closest('.cta')) {
bannerClick(e.target.innerText, targetObject.pageName);
}
if (e.target.closest('.open-form-on-click')) {
const formClickSection = e.target.closest('.open-form-on-click');
handleOpenFormOnClick(formClickSection);
}
} else if (this.closest('.carousel-articles-wrapper')) {
readMoreAnalytics(e);
} else if (this.closest('.csr-committee-wrapper')) {
Expand Down
76 changes: 39 additions & 37 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ export async function decorateMain(main) {
decorateSections(main);
decorateBlocks(main);
decorateImageIcons(main);
handleOpenFormOnClick(main);
}

/**
Expand Down Expand Up @@ -1048,44 +1049,45 @@ export function showingStateCity(searchInputAll) {
handleNeeyatClick();
}, 5000); */

window.addEventListener("load", () => {
// Initialize IntersectionObserver
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
if (entry.target.classList.contains("open-form-on-click")) {
handleOpenFormOnClick();
} else if (entry.target.classList.contains("neeyat-click")) {
handleNeeyatClick(entry.target);
}
observer.unobserve(entry.target);
}
});
}, { rootMargin: "50px" });

// Observe elements - Fixed version
const formSections = document.querySelectorAll('.open-form-on-click');
const neeyatSections = document.querySelectorAll('.neeyat-click');

// Handle formSections
if (formSections.length > 0) {
formSections.forEach(section => {
observer.observe(section);
});
}

// Handle neeyatSections
if (neeyatSections.length > 0) {
neeyatSections.forEach(section => {
observer.observe(section);
});
}
});


function handleOpenFormOnClick() {
const formButtons = document.querySelectorAll('.open-form-on-click .button-container');
// window.addEventListener("load", () => {
// // Initialize IntersectionObserver
// const observer = new IntersectionObserver((entries, observer) => {
// entries.forEach(entry => {
// if (entry.isIntersecting) {
// if (entry.target.classList.contains("open-form-on-click")) {
// handleOpenFormOnClick();
// } else if (entry.target.classList.contains("neeyat-click")) {
// handleNeeyatClick(entry.target);
// }
// observer.unobserve(entry.target);
// }
// });
// }, { rootMargin: "50px" });

// // Observe elements - Fixed version
// const formSections = document.querySelectorAll('.open-form-on-click');
// const neeyatSections = document.querySelectorAll('.neeyat-click');

// // Handle formSections
// if (formSections.length > 0) {
// formSections.forEach(section => {
// observer.observe(section);
// });
// }

// // Handle neeyatSections
// if (neeyatSections.length > 0) {
// neeyatSections.forEach(section => {
// observer.observe(section);
// });
// }
// });


export function handleOpenFormOnClick(el) {
const formButtons = el.querySelectorAll('.open-form-on-click .button-container');
formButtons.forEach(button => {
console.log(button);
button.addEventListener('click', onCLickApplyFormOpen);
});
}
Expand Down

0 comments on commit 56e8815

Please sign in to comment.