Home > Web Front-end > Bootstrap Tutorial > Where is the bootstrap pop-up code written?

Where is the bootstrap pop-up code written?

爱喝马黛茶的安东尼
Release: 2019-07-17 11:13:32
Original
2738 people have browsed it

Where is the bootstrap pop-up code written?

How to create a popover

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

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

<a href="#" data-toggle="popover" title="弹出框标题" data-content="弹出框内容">多次点我</a>
Copy after login

Note: The pop-up box must be written in the jQuery initialization code: Then in Calls the popover() method on the specified element.

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

Examples

$(document).ready(function(){    
$(&#39;[data-toggle="popover"]&#39;).popover(); 
});
Copy after login

Where is the bootstrap pop-up code written?

Specify the position of the popup box

By default the popup box is displayed on the right side of the element.

You can use the data-placement attribute to set the direction of the pop-up box display: top, bottom, left or right:

Example

<a href="#" title="Header" data-toggle="popover" data-placement="top" data-content="Content">点我</a>
<a href="#" title="Header" data-toggle="popover" data-placement="bottom" data-content="Content">点我</a>
<a href="#" title="Header" data-toggle="popover" data-placement="left" data-content="Content">点我</a>
<a href="#" title="Header" data-toggle="popover" data-placement="right" data-content="Content">点我</a>
Copy after login

Where is the bootstrap pop-up code written?

Related recommendations: "bootstrap Getting Started Tutorial"

Close the pop-up box

By default, the pop-up box will close after clicking the specified element again. will close, you can use the data-trigger="focus" attribute to set the pop-up box to close when the mouse clicks outside the element:

Example

<a href="#" title="取消弹出框" data-toggle="popover" data-trigger="focus" data-content="点击文档的其他地方关闭我">
点我</a>
Copy after login

Where is the bootstrap pop-up code written?

Tip: If you want to achieve the effect of displaying when the mouse moves over the element and disappearing after removal, you can use the data-trigger attribute and set the value to "hover":

Instance

<a href="#" title="Header" data-toggle="popover" data-trigger="hover" data-content="一些内容">鼠标移动到我这</a>
Copy after login

Where is the bootstrap pop-up code written?

The above is the detailed content of Where is the bootstrap pop-up code written?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template