top of page
bottom of page
(function() {
function fixFormIframe() {
const iframe = document.querySelector('iframe[src*="ab-civil-website-service-request.vercel.app"]');
if (iframe) {
iframe.removeAttribute('height');
iframe.style.height = 'auto';
iframe.style.minHeight = '900px'; // Start with a larger minimum
iframe.style.maxHeight = 'none';
iframe.style.overflow = 'hidden';
const container = iframe.parentElement;
if (container) {
container.style.height = 'auto';
container.style.overflow = 'visible';
}
console.log('Form iframe height fixed');
}
}
window.addEventListener('message', function(event) {
if (event.origin !== 'https://ab-civil-website-service-request.vercel.app') return;
if (event.data && event.data.type === 'setHeight') {
const iframe = document.querySelector('iframe[src*="ab-civil-website-service-request.vercel.app"]');
if (iframe) {
const newHeight = event.data.height + 50; // Add padding
iframe.style.height = newHeight + 'px';
iframe.style.minHeight = newHeight + 'px';
console.log('Iframe height updated to:', newHeight);
}
}
});
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', fixFormIframe);
} else {
fixFormIframe();
}
setTimeout(fixFormIframe, 1000);
setTimeout(fixFormIframe, 3000);
const checkForIframe = setInterval(function() {
const iframe = document.querySelector('iframe[src*="ab-civil-website-service-request.vercel.app"]');
if (iframe) {
fixFormIframe();
clearInterval(checkForIframe);
}
}, 500);
setTimeout(function() {
clearInterval(checkForIframe);
}, 10000);
})();