Detailed explanation of the information prompt box in Bootstrap

青灯夜游
Release: 2021-04-14 19:47:53
forward
2739 people have browsed it

This article will give you a detailed introduction to the information prompt box in Bootstrap. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Detailed explanation of the information prompt box in Bootstrap

The prompt box is a relatively common function. Generally speaking, when the mouse moves over a specific element, relevant prompts are displayed. [Related recommendations: "bootstrap Tutorial"]

Basic usage

The prompt box in the Bootstrap framework has a very simple structure and is often used. Create a button

1. Define the prompt information through the value of the title attribute (you can also use the custom attribute src-title to set the prompt information) , the title attribute has a high priority

2. Use the data-placement custom attribute to control the position of the prompt information box. According to four different positions, data-placement has four values: top, right, bottom and left, respectively indicating that the prompt box appears at the top, right, bottom and left

3. There is also the most important parameter that is indispensable, data-toggle="tooltip"

[Triggering method]

The triggering method of the prompt box in the Bootstrap framework is slightly different from the plug-in introduced earlier. It cannot be triggered directly through the custom attribute data-. Must rely on JavaScript code triggering

The simplest triggering method is as follows:

$(function(){
    $('[data-toggle="tooltip"]').tooltip();
});
Copy after login





Copy after login

Detailed explanation of the information prompt box in Bootstrap

##Attribute parameters

The prompt box component provides 7 custom attribute parameters for setting the prompt box








Copy after login

Detailed explanation of the information prompt box in Bootstrap

JS trigger

In addition to the simplest trigger method mentioned above, you can also specify an element separately, call the Tooltip component on the element, and provide various custom parameters in the form of javascript. There is no need to use element custom attributes starting with data-

$(element).tooltip(options);
Copy after login


Copy after login

Detailed explanation of the information prompt box in Bootstrap

[Keywords]

In addition to using the options object, you can also use keywords, 'show', 'hide', 'toggle', 'destroy'








Copy after login

Detailed explanation of the information prompt box in Bootstrap

【Event】

This plug-in supports 5 types of event subscriptions

show.bs.tooltip        show方法调用之后立即触发该事件
shown.bs.tooltip      此事件在tooltip已经显示出来(并且同时在 CSS 过渡效果完成)之后被触发
hide.bs.tooltip        hide方法调用之后立即触发该事件。
hidden.bs.tooltip     此事件在tooltip被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
inserted.bs.tooltip    当tooltip模板加载到DOM中上时,在show.bs.tooltip触发后,触发该事件
Copy after login

Copy after login

Detailed explanation of the information prompt box in Bootstrap##More programming related knowledge , please visit:

programming video

! !

The above is the detailed content of Detailed explanation of the information prompt box in Bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!