How to Create Tooltip Animation Plugin for jQuery

If you are looking for the Tooltip Animation Plugin for jQuery then you are at the right place. This tutorial, we are going to create tooltip plugin on your web page. We are going to use HTML, CSS, and jQuery to create this and the feature is to have an animated effect. You can customize the animated popups effect to enhance your web page default tooltips. Kindly include this CSS file link to create the tooltip effect to your HEAD tag of your page.
  1. <link rel="stylesheet" href="jquery.mytooltip.css">
  2. <link rel="stylesheet" href="demo/style.css">
  3. <script src="jquery-1.11.3.min.js"></script>
  4. <script src="jquery.mytooltip.js"></script>
  5. <script src="demo/script.js"></script>
Create markup basic action button that triggers by clicking or hover by default.
  1. <div class="js-mytooltip type-inline-block style-block style-block-one"
  2. data-mytooltip-custom-class="align-center"
  3. data-mytooltip-content="Direction default - top">Top
  4. </div>
Short script source code to initialize the tooltip plugin.
  1. $('.js-mytooltip').myTooltip();
Kindly copy and paste the source code events.
  1. // custom-events
  2. $('.custom-event').on('show-before', function(event) {
  3. console.log('show-before!')
  4. });
  5.  
  6. $('.custom-event').on('show-complete', function(event, content) {
  7. console.info(content);
  8. console.log('show-complete!');
  9. });
  10.  
  11. $('.custom-event').on('hide-before', function(event) {
  12. console.log('hide-before!');
  13. });
  14.  
  15. $('.custom-event').on('hide-complete', function(event) {
  16. console.log('hide-complete!');
  17. });
And, this is the public methods for the tooltip plugin.
  1. // destroy
  2. $('.destroy-element').on('click', function(event) {
  3. event.preventDefault();
  4. $('.destroy-current').myTooltip('destroy');
  5. });
  6.  
  7. // call
  8. setTimeout(function() {
  9. $('.download-header').myTooltip('call');
  10. }, 300);

Output


Result
Hope that this simple yet useful tutorials that I created may help you to your future projects. Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.

Add new comment