Bootstrap click the blank pover pop-up box to hide the instance and bootstrappover

Source: Internet
Author: User

Bootstrap click the blank pover pop-up box to hide the instance and bootstrappover

Code:

<Div> <a class = "btn-success show" title = "Popover title" data-container = "body" data-toggle = "popover" data-placement = "bottom "data-content =" some content in Popover at the bottom "> aaaa </a> </div> <script >$ (function () {initPopover () ;}) function initPopover () {$ (". show "). popover ({container: "body", trigger: "manual" // manually triggered }). on ('Show. bs. popover ', function () {$ (this ). addClass ("popover_open ");}). on ('hide. bs. popover ', function () {$ (this ). removeClass ("popover_open") ;}); $ (". show "). click (function () {if ($ (this ). hasClass ("popover_open") {$ (this ). popover ("hide")} else {$ (". popover_open "). popover ("hide"); $ (this ). popover ("show");} var e = arguments. callee. caller. arguments [0] | event; e. stopPropagation () ;}); $ (document ). click (function () {$ (". show "). popover ("hide") ;}}</script>

Note:

1. Not applicable to buttons, a, img, etc.

2. show. bs. popover: this event is triggered immediately when the show instance method is called.

Shown. bs. popover: this event is triggered when the pop-up dialog box is complete (it will wait until the CSS transition effect is complete ).
Hide. bs. popover: this event is triggered immediately when the hide instance method is called.
Hidden. bs. popover: this event is triggered when the tooltip is completely hidden (it will wait until the CSS transition effect is completed ).

3. Introduce jquery and bootstrap header files

4. Cancel bubbling

In the above bootstrap example, click the popover pop-up box in the blank space to hide all the content shared by the editor. I hope to give you a reference and support for the help house.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.