File size: 7,283 Bytes
ec1ba75 bf1a1cb ec1ba75 8b29c2c ec1ba75 6551536 e43032d ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e ec1ba75 d05829e 650b73c d05829e ec1ba75 d05829e f670153 ec1ba75 d05829e f670153 d05829e f670153 d05829e f670153 d05829e f670153 ec1ba75 d05829e f670153 650b73c d05829e f670153 ec1ba75 650b73c d05829e ec1ba75 d05829e ec1ba75 d05829e f670153 d05829e f670153 d05829e 650b73c fa657d4 f670153 650b73c ec1ba75 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background-color: white;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
}
.nav-container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
}
.logo img {
height: 40px;
}
@keyframes gradientFlow {
0% {background-position: 0% 50%;}
50% {background-position: 100% 50%;}
100% {background-position: 0% 50%;}
}
.logo-icon {
color: #457B9D;
}
.site-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.6rem 1rem;
background: #fff;
border-bottom: 1px solid #eee;
position: relative;
z-index: 999;
}
.logo a {
text-decoration: none;
font-weight: 700;
color: #0a0a0a;
display: flex;
align-items: center;
}
.nav-list {
display: flex;
gap: 1.2rem;
list-style: none;
margin: 0;
padding: 0;
}
.nav-list a {
text-decoration: none;
padding: 0.4rem 0.6rem;
display: block;
color: #1a202c;
font-weight: 500;
transition: color 0.2s;
position: relative;
}
.nav-list a:hover {
color: #E63946;
}
.nav-list a::after {
content: '';
position: absolute;
bottom: -4px;
left: 0;
width: 0;
height: 2px;
background-color: #E63946;
transition: width 0.2s;
}
.nav-list a:hover::after {
width: 100%;
}
.cta-button {
background-color: #E63946;
color: white;
padding: 0.5rem 1.25rem;
border-radius: 0.375rem;
font-weight: 500;
transition: background-color 0.2s;
}
.cta-button:hover {
background-color: #c1121f;
}
/* Hamburger button */
.nav-toggle {
display: none;
background: none;
border: 0;
cursor: pointer;
padding: 0.4rem;
}
.hamburger {
display: block;
width: 22px;
height: 2px;
background: #000;
position: relative;
}
.hamburger::before,
.hamburger::after {
content: "";
position: absolute;
left: 0;
width: 22px;
height: 2px;
background: #000;
}
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }
/* Responsive rules */
@media (max-width: 768px) {
.nav-list {
flex-direction: column;
gap: 1rem;
padding: 1rem;
}
/* Mobile menu styling */
.primary-nav {
position: fixed;
top: var(--header-h);
left: 0;
right: 0;
bottom: 0;
background: #fff;
z-index: 900;
overflow-y: auto;
transform: translateX(100%);
transition: transform 300ms ease;
will-change: transform;
padding-bottom: 2rem;
}
.primary-nav.open {
transform: translateX(0);
}
/* show hamburger on mobile */
.nav-toggle {
display: block;
margin-left: auto;
z-index: 1000;
}
/* CTA button styling */
.cta-button {
display: block;
width: calc(100% - 2rem);
margin: 1rem auto;
text-align: center;
}
/* Header styling */
.site-header {
position: fixed;
top: 0;
left: 0;
right: 0;
background: white;
z-index: 1000;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 0.5rem 1rem;
height: var(--header-h);
display: flex;
align-items: center;
justify-content: space-between;
}
/* Prevent body scroll when menu open */
body.menu-open {
overflow: hidden;
}
}
</style>
<header class="site-header">
<div class="logo">
<a href="/">
<img src="https://huggingface.co/spaces/iWaffle21/phoenix-sparkle-power-wash-pro/resolve/main/images/logo%20pw.png" alt="Phoenix Pressure Washing Logo" class="h-16 mr-2">
<span class="hidden md:inline text-xl" style="background: linear-gradient(90deg, #2196F3 0%, #E53935 100%); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.1);">PHOENIX PRESSURE WASHING</span>
</a>
</div>
<button class="nav-toggle" aria-controls="primary-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="hamburger"></span>
</button>
<nav id="primary-nav" class="primary-nav" role="navigation" aria-label="Main">
<ul class="nav-list">
<li><a href="/">Home</a></li>
<li><a href="/services.html">Services</a></li>
<li><a href="/holiday-lighting.html">Holiday Lighting</a></li>
<li><a href="/gallery.html">Gallery</a></li>
<li><a href="/estimate-calculator.html">Free Quote Calculator</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
<div class="px-4">
<a href="/contact.html" class="cta-button block text-center">Get Free Quote</a>
</div>
</nav>
</header>
`;
feather.replace();
// Mobile menu toggle functionality
const btn = this.shadowRoot.querySelector('.nav-toggle');
const nav = this.shadowRoot.getElementById('primary-nav');
const headerHeight = 64; // Fixed header height for mobile
if (btn && nav) {
btn.addEventListener('click', function () {
const expanded = btn.getAttribute('aria-expanded') === 'true';
btn.setAttribute('aria-expanded', String(!expanded));
nav.classList.toggle('open');
document.body.classList.toggle('menu-open', !expanded);
});
}
// Set fixed header height and padding
document.documentElement.style.setProperty('--header-h', `${headerHeight}px`);
document.body.style.paddingTop = `${headerHeight}px`;
}
}
customElements.define('custom-navbar', CustomNavbar); |