الگو:منو اصلی/بخشنده: تفاوت میان نسخهها
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
| خط ۴: | خط ۴: | ||
<meta charset="UTF-8"> | <meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="محصولات مخزن پلی اتیلن - انواع مخازن آب شرب، صنعتی و ظرفیتهای مختلف به همراه استعلام قیمت و راهنمای خرید"> | |||
<meta name="description" content=" | <title>مخزن پلی اتیلن | انواع مخازن و استعلام قیمت</title> | ||
< | |||
<style> | <style> | ||
/* ===== تنظیمات پایه ===== */ | |||
*, *::before, *::after { | |||
box-sizing: border-box; | |||
margin: 0; | |||
padding: 0; | |||
} | |||
html { | |||
font-size: 100%; /* 16px پیشفرض برای دسترسپذیری */ | |||
} | |||
} | |||
body { | |||
font-family: 'Vazirmatn', Tahoma, sans-serif; | |||
line-height: 1.6; | |||
} | |||
} | |||
header | /* ======================================== | ||
مرحله ۱: موبایل (پایه) — تا 768px | |||
======================================== */ | |||
.poly-header { | |||
background: #0a5c8a; | |||
} | box-shadow: 0 2px 8px rgba(0,0,0,0.15); | ||
position: sticky; | |||
top: 0; | |||
z-index: 1000; | |||
} | |||
.poly-menu-container { | |||
max-width: 1200px; | |||
margin: 0 auto; | |||
padding: 12px 16px; | |||
} | |||
.poly-nav { | |||
display: flex; | |||
align-items: center; | |||
} | justify-content: space-between; | ||
gap: 12px; | |||
} | |||
/* | /* دکمه همبرگر */ | ||
.poly-nav__toggle { | |||
display: flex; | |||
flex-direction: column; | |||
gap: 5px; | |||
background: none; | |||
border: none; | |||
cursor: pointer; | |||
padding: 8px; | |||
} | |||
. | .poly-nav__bar { | ||
width: 26px; | |||
height: 3px; | |||
background: #fff; | |||
border-radius: 3px; | |||
transition: transform 0.3s, opacity 0.3s; | |||
} | |||
} | |||
/* لیست منو (در موبایل: مخفی و از پایین باز میشود) */ | |||
.poly-nav__list { | |||
} | display: none; | ||
flex-direction: column; | |||
position: absolute; | |||
top: 100%; | |||
right: 0; | |||
left: 0; | |||
background: #0a5c8a; | |||
list-style: none; | |||
padding: 12px; | |||
box-shadow: 0 8px 16px rgba(0,0,0,0.2); | |||
} | |||
.poly-nav__list.is-open { | |||
display: flex; | |||
} | |||
.poly-nav__list a { | |||
color: #fff; | |||
text-decoration: none; | |||
padding: 12px 16px; | |||
display: block; | |||
border-radius: 6px; | |||
transition: background 0.3s; | |||
} | |||
.poly-nav__list a:hover, | |||
display:none; | .poly-nav__list a:focus-visible { | ||
background: rgba(255,255,255,0.15); | |||
} | |||
/* منوی کشویی (در موبایل: زیر آیتم باز میشود) */ | |||
.poly-dropdown__content { | |||
display: none; | |||
flex-direction: column; | |||
background: rgba(0,0,0,0.15); | |||
border-radius: 6px; | |||
margin: 4px 16px; | |||
padding: 4px 0; | |||
} | |||
.poly-dropdown.is-open .poly-dropdown__content { | |||
display: flex; | |||
} | |||
.poly-dropdown__content a { | |||
font-size: 0.95rem; | |||
padding: 10px 16px; | |||
} | |||
} | /* دکمه ثبت نام سریع */ | ||
.poly-btn--register { | |||
background: #f59e0b; /* رنگ نارنجی برای جلب توجه */ | |||
color: #1a1a1a; | |||
font-weight: 700; | |||
text-decoration: none; | |||
padding: 10px 20px; | |||
border-radius: 8px; | |||
transition: background 0.3s, transform 0.2s; | |||
white-space: nowrap; | |||
font-size: 0.95rem; | |||
} | |||
.poly-btn--register:hover, | |||
.poly-btn--register:focus-visible { | |||
background: #fbbf24; | |||
transform: translateY(-2px); | |||
} | |||
/* =========================== | /* ======================================== | ||
مرحله ۲: تبلت — 768px به بالا | |||
=========================== */ | ======================================== */ | ||
@media (min-width: 768px) { | |||
/* همبرگر مخفی شود */ | |||
.poly-nav__toggle { | |||
display: none; | |||
} | |||
/* منو به حالت افقی دربیاید */ | |||
.poly-nav__list { | |||
display: flex; | |||
flex-direction: row; | |||
position: static; | |||
background: none; | |||
box-shadow: none; | |||
padding: 0; | |||
gap: 4px; | |||
flex: 1; | |||
justify-content: flex-start; | |||
} | |||
.poly-nav__list > li { | |||
position: relative; | |||
} | |||
/* منوی کشویی (در دسکتاپ: آبشاری) */ | |||
.poly-dropdown__content { | |||
display: none; | |||
position: absolute; | |||
top: 100%; | |||
right: 0; | |||
background: #fff; | |||
min-width: 220px; | |||
border-radius: 8px; | |||
box-shadow: 0 8px 16px rgba(0,0,0,0.2); | |||
padding: 8px 0; | |||
margin: 0; | |||
} | |||
.poly-dropdown__content a { | |||
color: #333; | |||
padding: 10px 20px; | |||
border-radius: 0; | |||
} | |||
.poly-dropdown__content a:hover { | |||
background: #e8f4fd; | |||
color: #0a5c8a; | |||
} | |||
/* باز شدن با hover در دسکتاپ */ | |||
.poly-dropdown:hover .poly-dropdown__content, | |||
.poly-dropdown:focus-within .poly-dropdown__content { | |||
display: block; | |||
} | |||
} | |||
/* ======================================== | |||
مرحله ۳: دسکتاپ بزرگ — 1200px به بالا | |||
======================================== */ | |||
@media (min-width: 1200px) { | |||
.poly-menu-container { | |||
padding: 12px 24px; | |||
} | |||
.poly-nav__list a { | |||
font-size: 1rem; | |||
padding: 12px 18px; | |||
} | |||
.poly-btn--register { | |||
< | font-size: 1rem; | ||
padding: 12px 24px; | |||
} | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<!-- ===== هدر + منوی ناوبری ===== --> | |||
<header class="poly-header"> | |||
<div class="poly-menu-container"> | |||
<nav class="poly-nav" aria-label="منوی محصولات مخزن پلی اتیلن"> | |||
<!-- دکمه همبرگر (موبایل) --> | |||
<button class="poly-nav__toggle" aria-label="باز کردن منو" aria-expanded="false" aria-controls="poly-nav-menu"> | |||
<span class="poly-nav__bar"></span> | |||
<span class="poly-nav__bar"></span> | |||
<span class="poly-nav__bar"></span> | |||
</button> | |||
<!-- لیست منو --> | |||
<ul class="poly-nav__list" id="poly-nav-menu"> | |||
<li><a href="/wiki/اصلی">اصلی</a></li> | |||
<li><a href="/wiki/مخزن_پلی_اتیلن_آب_شرب">مخزن آب شرب</a></li> | |||
<li><a href="/wiki/مخزن_پلی_اتیلن_صنعتی">مخزن صنعتی</a></li> | |||
<!-- منوی کشویی --> | |||
<li class="poly-dropdown"> | |||
<a href="/wiki/انواع_مخزن_پلی_اتیلن" class="poly-dropdown__link" aria-haspopup="true" aria-expanded="false"> | |||
انواع و ظرفیتها | |||
</a> | |||
<div class="poly-dropdown__content"> | |||
<a href="/wiki/مخزن_یک_قسمتی">مخزن یک قسمتی</a> | |||
<a href="/wiki/مخزن_دو_قسمتی">مخزن دو قسمتی</a> | |||
<a href="/wiki/مخزن_سه_قسمتی">مخزن سه قسمتی</a> | |||
<a href="/wiki/مخزن_پلی_اتیلن_بزرگ">مخازن با ظرفیت بالا</a> | |||
< | |||
</div> | </div> | ||
</li> | |||
<li><a href="/wiki/قیمت_مخزن_پلی_اتیلن">استعلام قیمت</a></li> | |||
<li><a href="/wiki/راهنمای_خرید_مخزن">راهنمای خرید</a></li> | |||
</ul> | |||
<!-- دکمه ثبت نام سریع (سمت راست) --> | |||
<div class="poly-nav__actions"> | |||
<a href="/wiki/ثبت_نام" class="poly-btn poly-btn--register">ثبت نام سریع</a> | |||
</div> | </div> | ||
</ | |||
</nav> | |||
</div> | </div> | ||
</header> | |||
<script> | |||
// ===== منوی همبرگر (موبایل) ===== | |||
const toggleBtn = document.querySelector('.poly-nav__toggle'); | |||
const navList = document.querySelector('.poly-nav__list'); | |||
toggleBtn.addEventListener('click', () => { | |||
const isOpen = navList.classList.toggle('is-open'); | |||
toggleBtn.setAttribute('aria-expanded', isOpen); | |||
}); | |||
// ===== منوی کشویی (لمسی در موبایل) ===== | |||
const dropdowns = document.querySelectorAll('.poly-dropdown'); | |||
dropdowns.forEach(dropdown => { | |||
const link = dropdown.querySelector('.poly-dropdown__link'); | |||
const toggle = () => { | |||
} | const isOpen = dropdown.classList.toggle('is-open'); | ||
link.setAttribute('aria-expanded', isOpen); | |||
}; | |||
link.addEventListener('click', (e) => { | |||
// فقط در موبایل: کلیک، زیرمنو را باز کند نه لینک را | |||
if (window.innerWidth < 768) { | |||
e.preventDefault(); | |||
toggle(); | |||
} | |||
}); | |||
}); | |||
// ===== بستن منو با کلیک بیرون ===== | |||
document.addEventListener('click', (e) => { | |||
if (!e.target.closest('.poly-nav')) { | |||
navList.classList.remove('is-open'); | |||
toggleBtn.setAttribute('aria-expanded', 'false'); | |||
dropdowns.forEach(d => d.classList.remove('is-open')); | |||
} | } | ||
}); | |||
</script> | |||
</body> | </body> | ||
</html> | </html> | ||