7.25. Bootstrap5 prompt box

发布时间 :2024-01-11 23:00:02 UTC      

The prompt box is a small pop-up window that appears when the mouse moves over the element and disappears when the mouse moves outside the element.

7.25.1. How to create a prompt box

By adding to elements data-bs-toggle="tooltip" let’s create a prompt box.

title property is what is displayed in the prompt box:

<button type="button" class="btn btn-primary" data-bs-toggle="tooltip" title="I am the prompt content!">Move the mouse over to me</button>

Note: the prompt box should be written in the initialization code of JavaScript: then call on the specified element tooltip() method.

The following examples can use prompt boxes anywhere in the document:

Example

var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  return new bootstrap.Tooltip(tooltipTriggerEl)
})

7.25.2. Specify the location of the prompt box

By default, the prompt box is displayed above the element.

You can use the ‘data bs placement’ attribute to set the direction of the prompt box display: top , bottom , left or right :

Example

<a href="#" data-bs-toggle="tooltip" data-bs-placement="top" title="I am the prompt content!">Move the mouse over to me</a>
<a href="#" data-bs-toggle="tooltip" data-bs-placement="bottom" title="I am the prompt content!">Move the mouse over to me</a>
<a href="#" data-bs-toggle="tooltip" data-bs-placement="left" title="I am the prompt content!">Move the mouse over to me</a>
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" title="I am the prompt content!">Move the mouse over to me</a>

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.