jeffMunya's picture
how do i dep[loy the app
11bf4da verified
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Copy code snippets functionality
document.querySelectorAll('code').forEach(code => {
code.addEventListener('click', () => {
const text = code.innerText;
navigator.clipboard.writeText(text).then(() => {
const originalText = code.innerText;
code.innerText = 'Copied!';
setTimeout(() => {
code.innerText = originalText;
}, 2000);
});
});
});
// Responsive adjustments
function handleResize() {
const main = document.querySelector('main');
if (window.innerWidth < 768) {
main.classList.add('px-2');
} else {
main.classList.remove('px-2');
}
}
window.addEventListener('resize', handleResize);
handleResize();