How to implement a floating box on the right side in bootstrap

WBOY
Release: 2022-05-06 11:34:22
Original
2957 people have browsed it

In bootstrap, you can use the popover plug-in to realize the floating box on the right side. This plug-in is used to provide an extended view. You can set the display direction of the floating box by setting the "data-placement" attribute in the element. The syntax is: "".

How to implement a floating box on the right side in bootstrap

The operating environment of this tutorial: Windows 10 system, bootstrap version 3.3.7, DELL G3 computer

How to implement the right floating box in bootstrap

Bootstrap pop-up box (Popover) plug-in

The pop-up box (Popover) is similar to the tool tip (Tooltip), providing an expanded view. To activate the popover, users simply hover over the element. The content of the popup box can be filled entirely using the Bootstrap Data API. This method relies on tooltips.

Usage

The popover plug-in generates content and markup according to requirements. By default, popovers are placed behind their triggering elements. You can add a popover in two ways:

  • Through the data attribute: To add a popover, just add data to an anchor/button tag -toggle="popover" will do. The title of the anchor is the text of the popover. By default, the plugin places the popover at the top.

  • Via JavaScript: Enable popover via JavaScript:

$('#identifier').popover(options)
Copy after login

Popover plugin Unlike the drop-down menus and other plugins discussed previously, it is not a pure CSS plugin. To use the plugin, you must activate it using jquery (read javascript). Use the following script to enable all popovers on the page:

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

The following example demonstrates the use of the popover plug-in through the data attribute.




 
Bootstrap 实例 - 弹出框(Popover)插件




Copy after login

Output result:

How to implement a floating box on the right side in bootstrap

Related recommendations: bootstrap tutorial

The above is the detailed content of How to implement a floating box on the right side in bootstrap. 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 [email protected]
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!