Get the App
SLTechnology News&Howtos  ›  Development  › 

Bootstrap pop-up window code how to write

Shulou Source: shulou.com Published: 2022-06-03 10:37:40 10月04日 Update

This article mainly shows you "how to write bootstrap pop-up code", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to write bootstrap pop-up code" this article.

Create a pop-up box by adding data-toggle= "popover" to the element.

The content of the title property is the title of the pop-up box, and the data-content property displays the text content of the pop-up box:

Point me many times.

Note: the pop-up box is written in the initialization code of jQuery: then call the popover () method on the specified element.

The following examples can use pop-up boxes anywhere in the document:

Example

(document) .ready (function () {$('[data-toggle= "popover"]') .popover ();})

Specify the location of the pop-up box

By default, the pop-up box is displayed on the right side of the element.

You can use the data-placement property to set the direction in which the pop-up box appears: top, bottom, left, or right:

Example

Click me.

Close the pop-up box

By default, the pop-up box closes when you click on the specified element again. You can use the data-trigger= "focus" attribute to close the pop-up box by setting it in the outer area of the mouse click element:

Example

Click me.

Tip: if you want to display the mouse over the element and disappear after removal, you can use the data-trigger attribute and set the value to "hover":

Example

Move the mouse to me above is "bootstrap pop-up window code how to write" all the content of this article, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Element content instance attribute code article mouse situation learning help move location again area right effect text document direction method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker Apple Shulou Technology MySQL