7.20. Bootstrap5 folding

发布时间 :2024-01-14 23:00:03 UTC      

Bootstrap5 folding can easily show and hide content.

7.20.1. Example

<button data-bs-toggle="collapse" data-bs-target="#demo">fold</button>

<div id="demo" class="collapse">
Here are some test contents...
</div>

Case analysis

.collapse class is used to specify a collapse element (< div > in the instance); clicking the button switches between hiding and showing.

To control the hiding and display of content, you need to use the <a> or <button> add on the element data-bs-toggle="collapse" property. data-target="#id" the property is the corresponding collapsed content (< div id= “demo” >).

Note: <a> you can use the element href property instead of data-bs-target attributes:

7.20.2. Example

<a href="#demo" data-bs-toggle="collapse">fold</a>

<div id="demo" class="collapse">
Here are some test contents...
</div>

Collapsed content is hidden by default, and you can add .show class to make the content display by default:

7.20.3. Example

<div id="demo" class="collapse show">
Here are some test contents...
</div>

The following example shows a simple accordion by extending the card component.

Note: use th data-bs-parent property to ensure that all collapsed elements are under the specified parent element, so that other options are hidden when one collapse option is displayed.

7.20.4. Example

<div id="accordion">
    <div class="card">
        <div class="card-header">
            <a class="btn" data-bs-toggle="collapse" href="#collapseOne">
            Option 1
            </a>
        </div>
        <div id="collapseOne" class="collapse show" data-bs-parent="#accordion">
            <div class="card-body">
            #1 Content: Rookie Tutorial - Learning not only skills, but also dreams!!!
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-header">
            <a class="collapsed btn" data-bs-toggle="collapse" href="#collapseTwo">
            Option 2
        </a>
        </div>
         <div id="collapseTwo" class="collapse" data-bs-parent="#accordion">
            <div class="card-body">
            #2 Content: Rookie Tutorial - Learning not only skills, but also dreams!!!
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-header">
            <a class="collapsed btn" data-bs-toggle="collapse" href="#collapseThree">
            Option 3
            </a>
        </div>
        <div id="collapseThree" class="collapse" data-bs-parent="#accordion">
            <div class="card-body">
            #3 Content: Rookie Tutorial - Learning not only skills, but also dreams!!!
            </div>
        </div>
    </div>
</div>
Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.