الگو:صفحه اصلی مغازه شما/دسته بندی موضوعی: تفاوت میان نسخهها
Esfandiari (بحث | مشارکتها) بدون خلاصۀ ویرایش |
Esfandiari (بحث | مشارکتها) بدون خلاصۀ ویرایش |
||
| خط ۱: | خط ۱: | ||
<html> | <html> | ||
<div class=" | <div class="faraghaib-custom-container"> | ||
<!-- بخش جستجو --> | <!-- بخش جستجو --> | ||
<div class="search- | <div class="fz-search-wrapper"> | ||
<input type="text" id="categorySearch" placeholder="جستجو... | <input type="text" id="categorySearch" placeholder="جستجو در دستهبندیها..."> | ||
</div> | </div> | ||
<!-- بخش فیلترها --> | <!-- بخش فیلترها --> | ||
<div class="filter-bar | <div class="fz-filter-bar"> | ||
<button class="filter-btn active" onclick="filterSelection(event, 'all') | <button class="fz-filter-btn active" onclick="filterSelection(event, 'all')">همه</button> | ||
<button class="filter-btn" onclick="filterSelection(event, 'tech') | <button class="fz-filter-btn" onclick="filterSelection(event, 'tech')">تکنولوژی</button> | ||
<button class="filter-btn" onclick="filterSelection(event, 'art')" | <button class="fz-filter-btn" onclick="filterSelection(event, 'art')">هنر</button> | ||
<button class="fz-filter-btn" onclick="filterSelection(event, 'science')">علوم</button> | |||
</div> | </div> | ||
<!-- شبکه کارتها | <!-- شبکه کارتها --> | ||
<div id="categoryGrid" class="category-grid"> | <div id="categoryGrid" class="fz-category-grid"> | ||
<!-- کارت | <!-- کارت ۱ --> | ||
<div class=" | <div class="fz-card tech"> | ||
<span class=" | <span class="fz-title">هوش مصنوعی</span> | ||
<span | <span class="fz-count">۱۲</span> | ||
</div> | </div> | ||
<div class=" | <!-- کارت ۲ --> | ||
<span class=" | <div class="fz-card art"> | ||
<span | <span class="fz-title">نقاشی دیجیتال</span> | ||
<span class="fz-count">۸</span> | |||
</div> | </div> | ||
<div class=" | <!-- کارت ۳ --> | ||
<span class=" | <div class="fz-card science"> | ||
<span | <span class="fz-title">فیزیک کوانتوم</span> | ||
<span class="fz-count">۵</span> | |||
</div> | </div> | ||
<div class=" | <!-- کارت ۴ --> | ||
<span class=" | <div class="fz-card tech"> | ||
<span | <span class="fz-title">برنامهنویسی</span> | ||
<span class="fz-count">۲۵</span> | |||
</div> | |||
<!-- کارت ۵ --> | |||
<div class="fz-card art"> | |||
<span class="fz-title">طراحی گرافیک</span> | |||
<span class="fz-count">۱۰</span> | |||
</div> | </div> | ||
| خط ۴۴: | خط ۵۳: | ||
<style> | <style> | ||
.category-grid { | /* جلوگیری از تداخل با قالب مدیاویکی */ | ||
display: grid; | .faraghaib-custom-container { | ||
grid-template-columns: repeat(4, 1fr); | direction: rtl !important; | ||
gap: | font-family: tahoma, arial, sans-serif !important; | ||
max-width: 1000px !important; | |||
margin: 20px auto !important; | |||
padding: 15px !important; | |||
background: #f9f9f9 !important; | |||
border-radius: 15px !important; | |||
border: 1px solid #c9e4d5 !important; | |||
display: block !important; /* جلوگیری از تغییر رفتار توسط قالب */ | |||
} | |||
/* استایل جستجو */ | |||
.fz-search-wrapper { margin-bottom: 15px; text-align: center; } | |||
.fz-search-wrapper input { | |||
width: 90%; padding: 8px 15px; border: 1px solid #c9e4d5; border-radius: 20px; outline: none; font-size: 14px; | |||
} | |||
/* استایل فیلترها */ | |||
.fz-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; } | |||
.fz-filter-btn { padding: 5px 15px; border-radius: 15px; border: none; background: #eee; cursor: pointer; font-size: 13px; transition: 0.3s; } | |||
.fz-filter-btn.active { background: #16bd78 !important; color: white !important; } | |||
/* شبکه کارتها - حل مشکل مربع شدن */ | |||
.fz-category-grid { | |||
display: grid !important; | |||
grid-template-columns: repeat(4, 1fr) !important; /* ۴ ستون */ | |||
gap: 10px !important; | |||
width: 100% !important; | |||
} | } | ||
/* استایل کارت - تبدیل به مستطیل باریک */ | |||
. | .fz-card { | ||
background: white !important; | |||
height: 40px !important; /* ارتفاع ثابت و کم برای جلوگیری از مربع شدن */ | |||
display: flex !important; | |||
align-items: center !important; /* مرکز قرار دادن عمودی */ | |||
justify-content: space-between !important; /* پخش کردن متن و عدد */ | |||
padding: 0 12px !important; | |||
border-radius: 8px !important; | |||
box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important; | |||
border-right: 5px solid #16bd78 !important; | |||
box-sizing: border-box !important; /* بسیار مهم برای کنترل ارتفاع */ | |||
cursor: pointer; | |||
transition: transform 0.2s ease; | |||
margin: 0 !important; /* حذف مارجینهای اجباری مدیاویکی */ | |||
} | |||
.fz-card:hover { transform: translateY(-2px); } | |||
/* فونت بزرگ داخل کارت باریک */ | |||
.fz-title { | |||
font-weight: bold !important; | |||
color: #333 !important; | |||
font-size: 16px !important; /* فونت بزرگ طبق درخواست تو */ | |||
white-space: nowrap; /* جلوگیری از شکستن خط که باعث مربع شدن میشود */ | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
} | } | ||
. | .fz-count { | ||
font-size: 13px !important; | |||
color: #666 !important; | |||
background: #f0fdf4; | |||
padding: 2px 8px; | |||
border-radius: 10px; | |||
} | } | ||
. | /* رنگهای دستهبندی */ | ||
.fz-card.tech { border-right-color: #16bd78 !important; } | |||
.fz-card.art { border-right-color: #ff9f43 !important; } | |||
.fz-card.science { border-right-color: #54a0ff !important; } | |||
/* واکنشگرایی */ | |||
@media (max-width: 768px) { | |||
.fz-category-grid { grid-template-columns: repeat(2, 1fr) !important; } | |||
} | |||
/* کلاس مخفی سازی */ | |||
.is-hidden { display: none !important; } | .is-hidden { display: none !important; } | ||
</style> | </style> | ||
<script> | <script> | ||
function filterSelection(event, category) { | function filterSelection(event, category) { | ||
const cards = document.getElementsByClassName(" | const cards = document.getElementsByClassName("fz-card"); | ||
const buttons = document.getElementsByClassName("filter-btn"); | const buttons = document.getElementsByClassName("fz-filter-btn"); | ||
for (let btn of buttons) { btn.classList.remove("active") | |||
for (let btn of buttons) { btn.classList.remove("active"); } | |||
event.currentTarget.classList.add("active"); | |||
for (let card of cards) { | for (let card of cards) { | ||
| خط ۸۶: | خط ۱۵۵: | ||
document.getElementById('categorySearch').addEventListener('keyup', function() { | document.getElementById('categorySearch').addEventListener('keyup', function() { | ||
const val = this.value.toLowerCase().trim(); | const val = this.value.toLowerCase().trim(); | ||
const cards = document.getElementsByClassName(" | const cards = document.getElementsByClassName("fz-card"); | ||
for (let card of cards) { | for (let card of cards) { | ||
const | const title = card.querySelector('.fz-title').innerText.toLowerCase(); | ||
card.classList.toggle("is-hidden", ! | card.classList.toggle("is-hidden", !title.includes(val)); | ||
} | } | ||
}); | }); | ||