Are you an electriciana HVAC contractora plumbera roofera landscaper | (function(){const id = "typewriter-ttl2xp";
const measureId = "measure-typewriter-ttl2xp";
const words = ["an electrician","a HVAC contractor","a plumber","a roofer","a landscaper"];
const speed = 100;
const delayBetweenWords = 4000;
const cursor = true;
function initTypewriter() {
const element = document.getElementById(id);
const measureContainer = document.getElementById(measureId);
if (!element || !measureContainer) return;
const placeholderSpan = element.querySelector(".typewriter-placeholder");
const textSpan = element.querySelector(".typewriter-text");
const cursorSpan = element.querySelector(".typewriter-cursor");
const measureWords = measureContainer.querySelectorAll(".measurement-word");
let displayText = "";
let isDeleting = false;
let wordIndex = 0;
let charIndex = 0;
let showCursor = true;
let wordHeights = [];
// Measure heights of all words
function measureHeights() {
wordHeights = Array.from(measureWords).map(span => span.offsetHeight);
// Set initial height
if (wordHeights.length > 0) {
element.style.height = `${wordHeights[0]}px`;
}
}
// Update height based on current word
function updateHeight() {
if (wordHeights[wordIndex]) {
element.style.height = `${wordHeights[wordIndex]}px`;
}
}
function type() {
const currentWord = words[wordIndex];
// Always show full word in placeholder to reserve space
placeholderSpan.textContent = currentWord;
if (!isDeleting) {
if (charIndex < currentWord.length) {
displayText = currentWord.substring(0, charIndex + 1);
textSpan.textContent = displayText;
charIndex++;
setTimeout(type, speed);
} else {
setTimeout(() => {
isDeleting = true;
type();
}, delayBetweenWords);
}
} else {
if (charIndex > 0) {
displayText = currentWord.substring(0, charIndex - 1);
textSpan.textContent = displayText;
charIndex--;
setTimeout(type, speed / 2);
} else {
isDeleting = false;
wordIndex = (wordIndex + 1) % words.length;
updateHeight(); // Update height when switching words
type();
}
}
}
function blinkCursor() {
if (!cursor || !cursorSpan) return;
showCursor = !showCursor;
cursorSpan.style.opacity = showCursor ? "1" : "0";
}
// Initial measurement
measureHeights();
// Remeasure on resize
let resizeTimeout;
window.addEventListener('resize', () => {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(measureHeights, 100);
});
type();
if (cursor) {
setInterval(blinkCursor, 500);
}
}
document.addEventListener("astro:page-load", initTypewriter);
})(); looking for more jobs?
Are you an electriciana HVAC contractora plumbera roofera landscaper | (function(){const id = "typewriter-rzx9uj";
const measureId = "measure-typewriter-rzx9uj";
const words = ["an electrician","a HVAC contractor","a plumber","a roofer","a landscaper"];
const speed = 100;
const delayBetweenWords = 4000;
const cursor = true;
function initTypewriter() {
const element = document.getElementById(id);
const measureContainer = document.getElementById(measureId);
if (!element || !measureContainer) return;
const placeholderSpan = element.querySelector(".typewriter-placeholder");
const textSpan = element.querySelector(".typewriter-text");
const cursorSpan = element.querySelector(".typewriter-cursor");
const measureWords = measureContainer.querySelectorAll(".measurement-word");
let displayText = "";
let isDeleting = false;
let wordIndex = 0;
let charIndex = 0;
let showCursor = true;
let wordHeights = [];
// Measure heights of all words
function measureHeights() {
wordHeights = Array.from(measureWords).map(span => span.offsetHeight);
// Set initial height
if (wordHeights.length > 0) {
element.style.height = `${wordHeights[0]}px`;
}
}
// Update height based on current word
function updateHeight() {
if (wordHeights[wordIndex]) {
element.style.height = `${wordHeights[wordIndex]}px`;
}
}
function type() {
const currentWord = words[wordIndex];
// Always show full word in placeholder to reserve space
placeholderSpan.textContent = currentWord;
if (!isDeleting) {
if (charIndex < currentWord.length) {
displayText = currentWord.substring(0, charIndex + 1);
textSpan.textContent = displayText;
charIndex++;
setTimeout(type, speed);
} else {
setTimeout(() => {
isDeleting = true;
type();
}, delayBetweenWords);
}
} else {
if (charIndex > 0) {
displayText = currentWord.substring(0, charIndex - 1);
textSpan.textContent = displayText;
charIndex--;
setTimeout(type, speed / 2);
} else {
isDeleting = false;
wordIndex = (wordIndex + 1) % words.length;
updateHeight(); // Update height when switching words
type();
}
}
}
function blinkCursor() {
if (!cursor || !cursorSpan) return;
showCursor = !showCursor;
cursorSpan.style.opacity = showCursor ? "1" : "0";
}
// Initial measurement
measureHeights();
// Remeasure on resize
let resizeTimeout;
window.addEventListener('resize', () => {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(measureHeights, 100);
});
type();
if (cursor) {
setInterval(blinkCursor, 500);
}
}
document.addEventListener("astro:page-load", initTypewriter);
})();
looking for more jobs?
Are you an electriciana HVAC contractora plumbera roofera landscaper | (function(){const id = "typewriter-yhhjw9";
const measureId = "measure-typewriter-yhhjw9";
const words = ["an electrician","a HVAC contractor","a plumber","a roofer","a landscaper"];
const speed = 100;
const delayBetweenWords = 4000;
const cursor = true;
function initTypewriter() {
const element = document.getElementById(id);
const measureContainer = document.getElementById(measureId);
if (!element || !measureContainer) return;
const placeholderSpan = element.querySelector(".typewriter-placeholder");
const textSpan = element.querySelector(".typewriter-text");
const cursorSpan = element.querySelector(".typewriter-cursor");
const measureWords = measureContainer.querySelectorAll(".measurement-word");
let displayText = "";
let isDeleting = false;
let wordIndex = 0;
let charIndex = 0;
let showCursor = true;
let wordHeights = [];
// Measure heights of all words
function measureHeights() {
wordHeights = Array.from(measureWords).map(span => span.offsetHeight);
// Set initial height
if (wordHeights.length > 0) {
element.style.height = `${wordHeights[0]}px`;
}
}
// Update height based on current word
function updateHeight() {
if (wordHeights[wordIndex]) {
element.style.height = `${wordHeights[wordIndex]}px`;
}
}
function type() {
const currentWord = words[wordIndex];
// Always show full word in placeholder to reserve space
placeholderSpan.textContent = currentWord;
if (!isDeleting) {
if (charIndex < currentWord.length) {
displayText = currentWord.substring(0, charIndex + 1);
textSpan.textContent = displayText;
charIndex++;
setTimeout(type, speed);
} else {
setTimeout(() => {
isDeleting = true;
type();
}, delayBetweenWords);
}
} else {
if (charIndex > 0) {
displayText = currentWord.substring(0, charIndex - 1);
textSpan.textContent = displayText;
charIndex--;
setTimeout(type, speed / 2);
} else {
isDeleting = false;
wordIndex = (wordIndex + 1) % words.length;
updateHeight(); // Update height when switching words
type();
}
}
}
function blinkCursor() {
if (!cursor || !cursorSpan) return;
showCursor = !showCursor;
cursorSpan.style.opacity = showCursor ? "1" : "0";
}
// Initial measurement
measureHeights();
// Remeasure on resize
let resizeTimeout;
window.addEventListener('resize', () => {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(measureHeights, 100);
});
type();
if (cursor) {
setInterval(blinkCursor, 500);
}
}
document.addEventListener("astro:page-load", initTypewriter);
})();
looking for
more jobs?