الگو:تب رده: تفاوت میان نسخهها
جزبدون خلاصۀ ویرایش برچسب: ویرایش مبدأ ۲۰۱۷ |
جزبدون خلاصۀ ویرایش برچسب: ویرایش مبدأ ۲۰۱۷ |
||
| خط ۱: | خط ۱: | ||
<div | <div class="tab-container"> | ||
<div class="tab-buttons"> | |||
<span class="tab-button active" data-tab="tab1">{{{1}}}</span> | |||
<span class="tab-button" data-tab="tab2">{{{2}}}</span> | |||
<span class="tab-button" data-tab="tab3">{{{3}}}</span> | |||
</div> | |||
<div class="tab-content active" id="tab1"> | |||
<categorytree mode="all" hideroot="true">{{{1}}}</categorytree> | |||
</div> | |||
<div class="tab-content" id="tab2"> | |||
<categorytree mode="all" hideroot="true">{{{2}}}</categorytree> | |||
</div> | |||
<div class="tab-content" id="tab3"> | |||
<categorytree mode="all" hideroot="true">{{{3}}}</categorytree> | |||
</div> | |||
</div> | |||
<style> | |||
.tab-container { | |||
border: 1px solid #ddd; | |||
border-radius: 8px; | |||
overflow: hidden; | |||
} | |||
.tab-buttons { | |||
display: flex; | |||
background: #f5f5f5; | |||
border-bottom: 1px solid #ddd; | |||
} | |||
.tab-button { | |||
flex: 1; | |||
text-align: center; | |||
padding: 12px; | |||
cursor: pointer; | |||
background: #f5f5f5; | |||
color: #333; | |||
border: none; | |||
font-size: 14px; | |||
} | |||
.tab-button.active { | |||
background: #4CAF50; | |||
color: white; | |||
font-weight: bold; | |||
} | |||
.tab-content { | |||
padding: 15px; | |||
display: none; | |||
} | |||
.tab-content.active { | |||
display: block; | |||
} | |||
</style> | |||
<script> | |||
document.addEventListener('DOMContentLoaded', function() { | |||
var tabButtons = document.querySelectorAll('.tab-button'); | |||
tabButtons.forEach(function(button) { | |||
button.addEventListener('click', function() { | |||
var tabId = this.getAttribute('data-tab'); | |||
// Remove active class from all buttons and contents | |||
document.querySelectorAll('.tab-button').forEach(function(btn) { | |||
btn.classList.remove('active'); | |||
}); | |||
document.querySelectorAll('.tab-content').forEach(function(content) { | |||
</ | content.classList.remove('active'); | ||
}); | |||
// Add active class to clicked button and corresponding content | |||
this.classList.add('active'); | |||
document.getElementById(tabId).classList.add('active'); | |||
}); | |||
}); | |||
}); | |||
</script> | |||
نسخهٔ ۲۹ سپتامبر ۲۰۲۵، ساعت ۱۵:۰۱
<style> .tab-container { border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.tab-buttons { display: flex; background: #f5f5f5; border-bottom: 1px solid #ddd; }
.tab-button { flex: 1; text-align: center; padding: 12px; cursor: pointer; background: #f5f5f5; color: #333; border: none; font-size: 14px; }
.tab-button.active { background: #4CAF50; color: white; font-weight: bold; }
.tab-content { padding: 15px; display: none; }
.tab-content.active { display: block; } </style>
<script> document.addEventListener('DOMContentLoaded', function() {
var tabButtons = document.querySelectorAll('.tab-button');
tabButtons.forEach(function(button) {
button.addEventListener('click', function() {
var tabId = this.getAttribute('data-tab');
// Remove active class from all buttons and contents
document.querySelectorAll('.tab-button').forEach(function(btn) {
btn.classList.remove('active');
});
document.querySelectorAll('.tab-content').forEach(function(content) {
content.classList.remove('active');
});
// Add active class to clicked button and corresponding content
this.classList.add('active');
document.getElementById(tabId).classList.add('active');
});
});
}); </script>