Skip to content

Commit

Permalink
Improved j-Tooltip again.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Sep 1, 2020
1 parent c6752bd commit 8277cbe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 20 additions & 6 deletions j-Tooltip/component.js
@@ -1,27 +1,41 @@
COMPONENT('tooltip', function(self, config, cls) {

var is = false;
var can = true;

self.singleton();
self.readonly();
self.blind();
self.nocompile && self.nocompile();

self.enable = function() {
can = true;
};

self.hideforce = function() {
self.aclass('hidden');
self.rclass(cls + '-visible');
is = false;
};

self.make = function() {
self.aclass(cls + ' hidden');
self.on('scroll + resize', self.hide);
self.on('scroll + resize', function() {
self.hide(true);
can = false;
setTimeout2(self.ID + 'can', self.enable, 1000);
});
};

self.hide = function(force) {
is && setTimeout2(self.ID, function() {
self.aclass('hidden');
self.rclass(cls + '-visible');
is = false;
}, force ? 1 : 200);
is && setTimeout2(self.ID, self.hideforce, force ? 1 : 200);
};

self.show = function(opt) {

if (!can)
return;

var tmp = opt.element ? opt.element instanceof jQuery ? opt.element[0] : opt.element.element ? opt.element.dom : opt.element : null;

if (is && tmp && self.target === tmp) {
Expand Down
2 changes: 1 addition & 1 deletion j-Tooltip/component.json
@@ -1,6 +1,6 @@
{
"datecreated": "2016-10-20T15:52:00.000Z",
"dateupdated": "2020-09-01T22:56:00.000Z",
"dateupdated": "2020-09-01T22:57:00.000Z",
"name": "j-Tooltip",
"tags": [
"tooltip",
Expand Down

0 comments on commit 8277cbe

Please sign in to comment.