बूटस्ट्रैप जे एस पतन
जेएस संक्षिप्त करें (संकुचित करें।जेएस)
संक्षिप्त करने योग्य घटकों जैसे अकॉर्डियन और नेविगेशन के लिए आधार शैलियाँ और लचीला समर्थन प्राप्त करें।
प्लगइन निर्भरता: संक्षिप्त करें के लिए ट्रांज़िशन प्लगइन को आपके बूटस्ट्रैप के संस्करण में शामिल करने की आवश्यकता है।
Collapsibles के बारे में एक ट्यूटोरियल के लिए, हमारा बूटस्ट्रैप संक्षिप्त ट्यूटोरियल पढ़ें ।
संक्षिप्त प्लगइन कक्षाएं
Class | Description | Example |
---|---|---|
.collapse | Hides the content | |
.collapse in | Shows the content | |
.collapsing | Added when the transition starts, and removed when it finishes |
डेटा के माध्यम से-* विशेषताएँ
बंधनेवाला तत्व का नियंत्रण स्वचालित रूप से असाइन करने के लिए बस डेटा-टॉगल = "पतन" और तत्व में डेटा-लक्ष्य जोड़ें। डेटा-लक्षित विशेषता संक्षिप्त को लागू करने के लिए एक सीएसएस चयनकर्ता को स्वीकार करती है। बंधनेवाला तत्व में वर्ग पतन जोड़ना सुनिश्चित करें। यदि आप इसे डिफ़ॉल्ट रूप से खोलना चाहते हैं, तो इसमें अतिरिक्त कक्षा जोड़ें।
उदाहरण
<button class="btn" data-toggle="collapse" data-target="#demo">Collapsible</button>
<div id="demo" class="collapse">
Some text..
</div>
युक्ति: एक संक्षिप्त नियंत्रण में अकॉर्डियन जैसा समूह प्रबंधन जोड़ने के लिए, डेटा विशेषता डेटा-पैरेंट = "# चयनकर्ता" जोड़ें।
जावास्क्रिप्ट के माध्यम से
इसके साथ मैन्युअल रूप से सक्षम करें:
$('.collapse').collapse()
विकल्प संक्षिप्त करें
विकल्प डेटा विशेषताओं या जावास्क्रिप्ट के माध्यम से पारित किए जा सकते हैं। डेटा विशेषताओं के लिए, विकल्प नाम को डेटा में जोड़ें- जैसा कि डेटा-पैरेंट = "" में है।
Name | Type | Default | Description |
---|---|---|---|
parent | selector | false | All collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the panel class) - See example below |
toggle | boolean | true | Toggles the collapsible element on invocation |
संक्षिप्त तरीके
निम्न तालिका सभी उपलब्ध पतन विधियों को सूचीबद्ध करती है।
Method | Description | Try it |
---|---|---|
.collapse(options) | Activates the collapsible element with an option. See options above for valid values | |
.collapse("toggle") | Toggles the collapsible element | |
.collapse("show") | Shows the collapsible element | |
.collapse("hide") | Hides the collapsible element |
घटनाएँ संक्षिप्त करें
निम्न तालिका सभी उपलब्ध संक्षिप्त घटनाओं को सूचीबद्ध करती है।
Event | Description | Try it |
---|---|---|
show.bs.collapse | Occurs when the collapsible element is about to be shown | |
shown.bs.collapse | Occurs when the collapsible element is fully shown (after CSS transitions have completed) | |
hide.bs.collapse | Occurs when the collapsible element is about to be hidden | |
hidden.bs.collapse | Occurs when the collapsible element is fully hidden (after CSS transitions have completed) |
और ज्यादा उदाहरण
सरल बंधनेवाला
निम्न उदाहरण एक बटन को किसी अन्य तत्व की विस्तृत और संक्षिप्त सामग्री को टॉगल करने के लिए बनाता है:
उदाहरण
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">
Simple collapsible
</button>
<div id="demo" class="collapse in">
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</div>
बंधनेवाला पैनल
निम्न उदाहरण एक छोटा पैनल दिखाता है:
उदाहरण
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">Collapsible panel</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">Panel Body</div>
<div class="panel-footer">Panel Footer</div>
</div>
</div>
</div>
बंधनेवाला सूची समूह
निम्नलिखित एक सूची समूह के साथ एक संक्षिप्त पैनल दिखाता है:
उदाहरण
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">Collapsible list group</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<ul class="list-group">
<li class="list-group-item">One</li>
<li class="list-group-item">Two</li>
<li class="list-group-item">Three</li>
</ul>
<div class="panel-footer">Footer</div>
</div>
</div>
</div>
अकॉर्डियन
निम्न उदाहरण पैनल घटक का विस्तार करके एक साधारण अकॉर्डियन दिखाता है:
ध्यान दें: विशेषता यह data-parent
सुनिश्चित करती है कि निर्दिष्ट पैरेंट के अंतर्गत सभी संक्षिप्त होने योग्य तत्व बंद हो जाएंगे जब एक छोटा होने योग्य आइटम दिखाया जाएगा।
उदाहरण
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
Collapsible Group 1</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body">Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
Collapsible Group 2</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse">
<div class="panel-body">Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse3">
Collapsible Group 3</a>
</h4>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.</div>
</div>
</div>
</div>
विस्तृत करें और संक्षिप्त करें टॉगल चिह्न और पाठ
बंधनेवाला सामग्री खोलते और बंद करते समय निम्न उदाहरण खुले/बंद टेक्स्ट और आइकन को बदलता है:
उदाहरण
$(document).ready(function(){
$("#demo").on("hide.bs.collapse", function(){
$(".btn").html('<span class="glyphicon glyphicon-collapse-down"></span> Open');
});
$("#demo").on("show.bs.collapse", function(){
$(".btn").html('<span class="glyphicon glyphicon-collapse-up"></span> Close');
});
});
या आप सीएसएस का उपयोग कर सकते हैं:
उदाहरण
/* Icon when the collapsible content is shown */
.btn:after {
font-family: "Glyphicons Halflings";
content: "\e114";
}
/* Icon when the collapsible content is hidden */
.btn.collapsed:after {
content: "\e080";
}