Permalink
Browse files

Fixed #14

  • Loading branch information...
stefangabos committed Dec 17, 2017
1 parent 94b9405 commit 751999f0a53006e09a2cd414cd0336190b3603ec
Showing with 47 additions and 25 deletions.
  1. +4 −0 CHANGELOG.md
  2. +4 −2 README.md
  3. +1 −1 dist/zebra_tooltips.min.js
  4. +19 −11 dist/zebra_tooltips.src.js
  5. +19 −11 src/zebra_tooltips.src.js
View
@@ -1,3 +1,7 @@
## version 1.3.2 (TBA)
- if the callback functions attached to the `onBeforeShow` and `onBeforeHide` events return boolean FALSE, the respective actions will be cancelled
## version 1.3.1 (May 30, 2017)
- some style updates
View
@@ -276,7 +276,8 @@ $(document).ready(function() {
<td valign="top"><code>onBeforeHide</code></td>
<td valign="top">
Event fired <em>before</em> a tooltip is hidden.<br>
The callback function receives as argument the element the tooltip is attached to, and the tooltip element.
The callback function receives as argument the element the tooltip is attached to, and the tooltip element.<br>
If the callback function returns boolean <code>FALSE</code>, the tooltip will not be hidden.
</td>
</tr>
<tr>
@@ -290,7 +291,8 @@ $(document).ready(function() {
<td valign="top"><code>onBeforeShow</code></td>
<td valign="top">
Event fired <em>before</em> a tooltip is shown.<br>
The callback function receives as argument the element the tooltip is attached to, and the tooltip element.
The callback function receives as argument the element the tooltip is attached to, and the tooltip element.<br>
If the callback function returns boolean <code>FALSE</code>, the tooltip will not be shown.
</td>
</tr>
<tr>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -23,7 +23,7 @@
* Read more {@link https://github.com/stefangabos/Zebra_Tooltips/ here}
*
* @author Stefan Gabos <contact@stefangabos.ro>
* @version 1.3.1 (last revision: May 30, 2017)
* @version 1.3.2 (last revision: December 17, 2017)
* @copyright (c) 2012 - 2017 Stefan Gabos
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
* @package Zebra_Tooltips
@@ -136,23 +136,29 @@
onBeforeHide: null, // Event fired before a tooltip is hidden.
//
// The callback function (if any) receives as arguments the
// element the tooltip is attached to, and the tooltip element.
// The callback function receives as arguments the element the
// tooltip is attached to, and the tooltip element.
//
// If the callback function returns boolean FALSE, the tooltip will
// not be hidden.
onHide: null, // Event fired after a tooltip is hidden.
//
// The callback function (if any) receives as arguments the
// element the tooltip is attached to, and the tooltip element.
// The callback function receives as arguments the element the
// tooltip is attached to, and the tooltip element.
onBeforeShow: null, // Event fired before a tooltip is shown.
//
// The callback function (if any) receives as arguments the
// element the tooltip is attached to, and the tooltip element.
// The callback function receives as arguments the element the
// tooltip is attached to, and the tooltip element.
//
// If the callback function returns boolean FALSE, the tooltip will
// not be shown.
onShow: null // Event fired after a tooltip is shown.
//
// The callback function (if any) receives as arguments the
// element the tooltip is attached to, and the tooltip element.
// The callback function receives as arguments the element the
// tooltip is attached to, and the tooltip element.
},
@@ -666,7 +672,8 @@
if (plugin.settings.onBeforeShow && typeof plugin.settings.onBeforeShow === 'function')
// execute the callback function
plugin.settings.onBeforeShow($element, tooltip_info.tooltip);
// don't go further if the callback function returned boolean FALSE
if (plugin.settings.onBeforeShow($element, tooltip_info.tooltip) === false) return;
// if tooltip is not already being animated
if (tooltip_info.tooltip.css('display') !== 'block')
@@ -740,7 +747,8 @@
if (plugin.settings.onBeforeHide && typeof plugin.settings.onBeforeHide === 'function')
// execute the callback function
plugin.settings.onBeforeHide($element, tooltip_info.tooltip);
// don't go further if the callback function returned boolean FALSE
if (plugin.settings.onBeforeHide($element, tooltip_info.tooltip) === false) return;
// set this flag to FALSE so that the script knows that it has to add the "close" button again
// if the tooltip is shown using the API
Oops, something went wrong.

0 comments on commit 751999f

Please sign in to comment.