


Bootstrap tooltip plug-in that you must learn every day_javascript skills
Tooltips are very useful when you want to describe a link. The Tooltip plugin was inspired by jQuery.tipsy written by Jason Frame. The Tooltip plug-in has made many improvements. For example, it does not need to rely on images, but instead uses CSS to achieve animation effects and uses the data attribute to store title information.
If you want to reference the functionality of this plugin separately, then you need to reference tooltip.js. Alternatively, as mentioned in the chapter Bootstrap Plugin Overview, you can reference bootstrap.js or a minified version of bootstrap.min.js.
1. Usage
Tooltip plug-ins generate content and markup on demand. By default, tooltips are placed after their triggering elements. You can add tooltips in the following two ways:
1. Through the data attribute: If you need to add a tooltip, just add data-toggle="tooltip" to an anchor tag. The title of the anchor is the text of the tooltip. By default, the plugin sets the tooltip at the top.
<a href="#" data-toggle="tooltip" title="Example tooltip">请悬停在我的上面</a>
2. Via JavaScript: Trigger tooltip via JavaScript:
$('#identifier').tooltip(options)
The Tooltip plugin is not a pure CSS plugin like the drop-down menus and other plugins discussed before. To use the plugin, you must activate it using jquery (read javascript). Use the following script to enable all tooltips on the page:
$(function () { $("[data-toggle='tooltip']").tooltip(); });
2. Options
Some options are added via the Bootstrap Data API or called via JavaScript. The options are listed in the table below:
3. Tooltip
//基本实例 <a href="#" data-toggle="tooltip" title="超文本标识符">HTML5</a> //JS 部分需要声明 $('#section').tooltip();
Tooltips have many properties to configure the display of tips, as follows:
<a href="#" rel="tooltip" data-toggle="tooltip" title="超文本标识符" data-animation="false" data-html="true" data-placement="auto" data-selector="a[rel=tooltip]" data-trigger="click" data-delay="500" data-template="<b>123</b>" >HTML5</a>
JavaScript method can directly remove the previous data. Including: animation, html, placement, selector, original-title, title, trigger, delay, container and template attributes.
//JavaScript 方式 $('#section a').tooltip({ delay : { show : 500, hide : 100, }, container : 'body' });
JavaScript has four methods: show, hide, toggle and destroy.
//显示 $('#section a').tooltip('show'); //隐藏 $('#section a').tooltip('hide'); //反转显示和隐藏 $('#section a').tooltip('toggle'); //隐藏并销毁 $('#section a').tooltip('destroy');
There are four types of events in Tooltip.
//Event, other similar
$('#select a').on('show.bs.tooltip', function() { alert('调用 show 时触发!'); });
The above is the entire content of this article, I hope it will be helpful to everyone’s study.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

Answer: You can use the date picker component of Bootstrap to view dates in the page. Steps: Introduce the Bootstrap framework. Create a date selector input box in HTML. Bootstrap will automatically add styles to the selector. Use JavaScript to get the selected date.

To verify dates in Bootstrap, follow these steps: Introduce the required scripts and styles; initialize the date selector component; set the data-bv-date attribute to enable verification; configure verification rules (such as date formats, error messages, etc.); integrate the Bootstrap verification framework and automatically verify date input when form is submitted.
