Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ To use css3 animation effects please include [Animate.css](http://daneden.github
| onBeforeShow | function(){} | Function to be executed before tipso is shown |
| onShow | function(){} | Function to be executed after tipso is shown |
| onHide | function(){} | Function to be executed after tipso is hidden |
| manageShowHide | true | Handle show hide events or only be controlled programmatically |

> Additionaly you can use `data-tipso` instead of the title attribute for the tooltip content ( set `useTitle: false` )

Expand Down
72 changes: 38 additions & 34 deletions src/tipso.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
templateEngineFunc: null, //A function that compiles and renders the content
onBeforeShow : null,
onShow : null,
onHide : null
onHide : null,
manageShowHide : true
};

function Plugin(element, options) {
Expand Down Expand Up @@ -112,44 +113,47 @@
$doc = this.doc;
$e.addClass('tipso_style').removeAttr('title');

if (obj.settings.tooltipHover) {
var waitForHover = null,
hoverHelper = null;
$e.on('mouseover' + '.' + pluginName, function() {
clearTimeout(waitForHover);
clearTimeout(hoverHelper);
hoverHelper = setTimeout(function(){
obj.show();
}, 150);
});
$e.on('mouseout' + '.' + pluginName, function() {
clearTimeout(waitForHover);
clearTimeout(hoverHelper);
waitForHover = setTimeout(function(){
obj.hide();
}, 200);

obj.tooltip()
.on('mouseover' + '.' + pluginName, function() {
obj.mode = 'tooltipHover';
})
.on('mouseout' + '.' + pluginName, function() {
obj.mode = 'show';
if (obj.settings.manageShowHide) {
if (obj.settings.tooltipHover) {
var waitForHover = null,
hoverHelper = null;
$e.on('mouseover' + '.' + pluginName, function() {
clearTimeout(waitForHover);
clearTimeout(hoverHelper);
hoverHelper = setTimeout(function(){
obj.show();
}, 150);
});
$e.on('mouseout' + '.' + pluginName, function() {
clearTimeout(waitForHover);
clearTimeout(hoverHelper);
waitForHover = setTimeout(function(){
obj.hide();
}, 200);
})
;
});
} else {
$e.on('mouseover' + '.' + pluginName, function() {
obj.show();
});
$e.on('mouseout' + '.' + pluginName, function() {
obj.hide();
});

obj.tooltip()
.on('mouseover' + '.' + pluginName, function() {
obj.mode = 'tooltipHover';
})
.on('mouseout' + '.' + pluginName, function() {
obj.mode = 'show';
clearTimeout(waitForHover);
waitForHover = setTimeout(function(){
obj.hide();
}, 200);
})
;
});
} else {
$e.on('mouseover' + '.' + pluginName, function() {
obj.show();
});
$e.on('mouseout' + '.' + pluginName, function() {
obj.hide();
});
}
}

if(obj.settings.ajaxContentUrl)
{
obj.ajaxContent = null;
Expand Down
Loading