Press "Enter" to skip to content

Create Popovers Elements in Javascript Plugin | Popover.js

A popover is a small JavaScript library for creating tooltip style popups and a popup menu around any DOM you select.

popover with html content, custom popover, pure css popover, popover example div content, popover on hover, pure css popover on click

Features:

  • It is triggered by a click or scroll event.
  • Smart positioning.
  • Smooth transitions.
  • With the arrow symbol/icon or not.

How to make use of it:

1. Import the mandatory JavaScript and CSS information into the doc.

<link rel="stylesheet" href="dist/popover.min.css" />
<script src="dist/popover.min.js"></script>

2. Insert content material into the popover.

<div id="popover-target">
  <div class="pop-comp-content">Popover Content</div>
</div>

3. Attach the popover to a component.

<button class="popover-demo" 
        data-popover-target="#popover-target">
        Click Me
</button>
PopoverComponent.init({
  ele: '.popover-demo'
});

4. You can the showOnHover choice to true if you want to show the popover on hover similar to a tooltip.

PopoverComponent.init({
  ele: '.popover-demo',
  showOnHover: true
});

5. You can also go the choices by way of HTML data-* attributes as follows:

<div class="popover-demo"
     data-popover-position="bottom"
></div>

6. Trigger features after the popover is proven & hidden.

PopoverComponent.init({
  ele: '.popover-demo',
  beforeShow: function(){
    // do something
  },
  beforeHide: function(){
    // do something
  }
  afterShow: function(){
    // do something
  },
  afterHide: function(){
    // do something
  }
});

Create Popovers Around Elements, Popover Plugin/Github


See Demo And Download

Official Website(sa-si-dev): Click Here

This superior jQuery/javascript plugin is developed by sa-si-dev. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *