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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ finalMessage| A message that appears at the end of the action for the confirm |
finalMessageDuration| Duration of the final message in ms |1000
onYes| Function that is triggered when clicking ‘Yes’ on confirm |empty
onNo | Function that is triggered when clicking ‘No’ on confirm |empty
onlyOne | Always make the only one of the tool tip is open |false
autoClose | After a specified time has elapsed, it closed with automatic | false
autoCloseDuration | Number of milliseconds elapsed before it closes automatically | 3000

###Demo and examples
[rubentd.com/darktooltip](http://rubentd.com/darktooltip)
Expand Down
28 changes: 24 additions & 4 deletions js/jquery.darktooltip.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
* DarkTooltip v0.3.2
* DarkTooltip v0.3.2.1
* Simple customizable tooltip with confirm option and 3d effects
* (c)2014 Rubén Torres - rubentdlh@gmail.com
* Released under the MIT license
*/

(function($) {

function DarkTooltip(element, options){
this.bearer = element;
this.options = options;
this.showEvent;
this.hideEvent;
this.mouseOverMode=(this.options.trigger == "hover" || this.options.trigger == "mouseover" || this.options.trigger == "onmouseover");
}
Expand All @@ -33,6 +33,16 @@
dt.hide();
});
}
else {
if (this.options.autoClose) {
if (this.showEvent) {
clearTimeout(dt.showEvent);
}
dt.showEvent = setTimeout(function(){
dt.tooltip.hide();
}, this.options.autoCloseDuration);
}
}
},

hide: function(){
Expand Down Expand Up @@ -93,7 +103,10 @@
}
this.contentType='html';
}else{
this.contentType='text';
this.contentType = this.options.defaultContentType;
if (this.contentType == '') {
this.contentType='text';
}
}
tooltipId = "";
if(this.bearer.attr("id") != ""){
Expand Down Expand Up @@ -172,6 +185,9 @@
this.bearer.click( function(e){
e.preventDefault();
dt.setPositions();
if (dt.options.onlyOne) {
$('.dark-tooltip:visible').hide();
}
dt.toggle();
e.stopPropagation();
});
Expand Down Expand Up @@ -259,7 +275,11 @@
yes: 'Yes',
autoTop: true,
autoLeft: true,
onClose: function(){}
onClose: function(){},
onlyOne: false,
autoClose: false,
autoCloseDuration: 3000,
defaultContentType: 'html'
};

})(jQuery);
21 changes: 20 additions & 1 deletion js/jquery.darktooltip.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.