Skip to content

Commit

Permalink
Adapted the onlyOne option to work fine with the multiple option
Browse files Browse the repository at this point in the history
  • Loading branch information
louisameline committed Apr 5, 2014
1 parent 99a567d commit 87db8d3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "tooltipster",
"version": "3.2.0",
"version": "3.2.1",
"main": ["js/jquery.tooltipster.min.js", "css/tooltipster.css"],
"dependencies": {
"jquery": ">=1.7"
Expand Down
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -590,6 +590,7 @@ <h3>Using several tooltips on a single element</h3>

// instantiate a second tooltip and keep the returned Tooltipster objects array for later use of the API
var tooltipsterObjects = $('#my-element').tooltipster({
// don't forget to provide content here as the 1st tooltip will have deleted the original title attribute of the element
content: 'My second tooltip',
multiple: true,
position: 'bottom'
Expand Down
20 changes: 13 additions & 7 deletions js/jquery.tooltipster.js
@@ -1,6 +1,6 @@
/*
Tooltipster 3.2.0 | 2014-04-05
Tooltipster 3.2.1 | 2014-04-05
A rockin' custom tooltip jQuery plugin
Developed by Caleb Jacob under the MIT license http://opensource.org/licenses/MIT
Expand Down Expand Up @@ -235,14 +235,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (self.options.onlyOne) {
$('.tooltipstered').not(self.$el).each(function(i,el) {

// we have to use the public methods here
var $el = $(el),
s = $el[pluginName]('status'),
ac = $el[pluginName]('option', 'autoClose');
nss = $el.data('tooltipster-ns');

if (s !== 'hidden' && s !== 'disappearing' && ac) {
$el[pluginName]('hide');
}
// iterate on all tooltips of the element
$.each(nss, function(i, ns){
var instance = $el.data(ns),
// we have to use the public methods here
s = instance.status(),
ac = instance.option('autoClose');

if (s !== 'hidden' && s !== 'disappearing' && ac) {
instance.hide();
}
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/jquery.tooltipster.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tooltipster.jquery.json
Expand Up @@ -5,7 +5,7 @@
"keywords": [
"tooltip"
],
"version": "3.2.0",
"version": "3.2.1",
"author": {
"name": "Caleb Jacob",
"url": "http://calebjacob.com/"
Expand Down

0 comments on commit 87db8d3

Please sign in to comment.