پرش به محتوا

الگو:تب رده: تفاوت میان نسخه‌ها

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

نسخهٔ ‏۲۹ سپتامبر ۲۰۲۵، ساعت ۱۵:۰۱

{{{1}}} {{{2}}} {{{3}}}

<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>