تست: تفاوت میان نسخهها
ظاهر
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
خط ۹۷: | خط ۹۷: | ||
background: white; | background: white; | ||
cursor: pointer; | cursor: pointer; | ||
text-align: right; | |||
} | } | ||
خط ۱۸۳: | خط ۱۷۶: | ||
width: 100%; | width: 100%; | ||
height: 100%; | height: 100%; | ||
} | } | ||
خط ۲۶۴: | خط ۲۵۶: | ||
<label for="bookSelect">انتخاب محتوا:</label> | <label for="bookSelect">انتخاب محتوا:</label> | ||
<div class="custom-select-container"> | <div class="custom-select-container"> | ||
<select id="bookSelect" | <div class="custom-select" id="customSelectDisplay"> | ||
ابتدا دستهبندی را انتخاب کنید | |||
</div> | |||
<select id="bookSelect" style="display: none;"> | |||
<option value="">ابتدا دستهبندی را انتخاب کنید</option> | <option value="">ابتدا دستهبندی را انتخاب کنید</option> | ||
</select> | </select> | ||
خط ۳۱۹: | خط ۳۱۴: | ||
const categorySelect = document.getElementById('categorySelect'); | const categorySelect = document.getElementById('categorySelect'); | ||
const bookSelect = document.getElementById('bookSelect'); | const bookSelect = document.getElementById('bookSelect'); | ||
const | const customSelectDisplay = document.getElementById('customSelectDisplay'); | ||
const customDropdown = document.getElementById('customDropdown'); | const customDropdown = document.getElementById('customDropdown'); | ||
const dropdownSearch = document.getElementById('dropdownSearch'); | const dropdownSearch = document.getElementById('dropdownSearch'); | ||
خط ۳۲۹: | خط ۳۲۴: | ||
let isDropdownOpen = false; | let isDropdownOpen = false; | ||
let currentCategory = ''; | let currentCategory = ''; | ||
let currentSelection = { value: '', text: '' }; | |||
// پر کردن لیست کتابها بر اساس دستهبندی | // پر کردن لیست کتابها بر اساس دستهبندی | ||
خط ۳۳۷: | خط ۳۳۳: | ||
if (!selectedCategory) { | if (!selectedCategory) { | ||
// اگر دستهبندی انتخاب نشده | // اگر دستهبندی انتخاب نشده | ||
customSelectDisplay.textContent = 'ابتدا دستهبندی را انتخاب کنید'; | |||
customSelectDisplay.style.color = '#6c757d'; | |||
resetContent(); | resetContent(); | ||
return; | return; | ||
خط ۳۴۵: | خط ۳۴۰: | ||
const books = booksData[selectedCategory]; | const books = booksData[selectedCategory]; | ||
customSelectDisplay.textContent = 'لطفاً محتوا انتخاب کنید'; | |||
customSelectDisplay.style.color = '#333'; | |||
resetContent(); | resetContent(); | ||
} | } | ||
// باز کردن/بستن dropdown | // باز کردن/بستن dropdown | ||
customSelectDisplay.addEventListener('click', function(e) { | |||
if ( | if (!currentCategory) return; | ||
e.stopPropagation(); | e.stopPropagation(); | ||
خط ۴۰۸: | خط ۳۸۹: | ||
optionItem.textContent = book.text; | optionItem.textContent = book.text; | ||
optionItem.setAttribute('data-value', book.value); | optionItem.setAttribute('data-value', book.value); | ||
optionItem.setAttribute('data-text', book.text); | |||
if (book.value === | if (book.value === currentSelection.value) { | ||
optionItem.classList.add('selected'); | optionItem.classList.add('selected'); | ||
} | } | ||
optionItem.addEventListener('click', function() { | optionItem.addEventListener('click', function() { | ||
const value = this.getAttribute('data-value'); | |||
const text = this.getAttribute('data-text'); | |||
currentSelection = { value, text }; | |||
customSelectDisplay.textContent = text; | |||
customSelectDisplay.style.color = '#333'; | |||
isDropdownOpen = false; | isDropdownOpen = false; | ||
customDropdown.style.display = 'none'; | customDropdown.style.display = 'none'; | ||
showContent(value, text); | |||
}); | }); | ||
خط ۴۹۷: | خط ۴۸۲: | ||
// بازنشانی محتوا | // بازنشانی محتوا | ||
function resetContent() { | function resetContent() { | ||
currentSelection = { value: '', text: '' }; | |||
contentFrame.style.display = 'none'; | contentFrame.style.display = 'none'; | ||
iframePlaceholder.style.display = 'flex'; | iframePlaceholder.style.display = 'flex'; | ||
خط ۵۱۱: | خط ۴۹۷: | ||
// رویداد تغییر دستهبندی | // رویداد تغییر دستهبندی | ||
categorySelect.addEventListener('change', updateBookList); | categorySelect.addEventListener('change', updateBookList); | ||
// بارگذاری اولیه - هیچ چیزی انتخاب نشده | // بارگذاری اولیه - هیچ چیزی انتخاب نشده |
نسخهٔ ۱۲ اکتبر ۲۰۲۵، ساعت ۲۰:۳۶
<!DOCTYPE html>
کتابخانه پدیا بایبل
در این بخش میتوانید کتابها و مقالات مختلف را مطالعه کنید.
برای شروع، دستهبندی و سپس مورد مورد نظر خود را انتخاب نمایید.
ابتدا دستهبندی را انتخاب کنید
لطفاً یک کتاب یا مقاله از لیست انتخاب کنید