From e26347a4235d26e5ad5b306ff7ae9493ea85b459 Mon Sep 17 00:00:00 2001 From: leonar15 Date: Wed, 26 Mar 2014 13:43:58 -0700 Subject: [PATCH 1/3] added example folder and first, simple tipsy example html file --- examples/example1.html | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/example1.html diff --git a/examples/example1.html b/examples/example1.html new file mode 100644 index 0000000..12a9e02 --- /dev/null +++ b/examples/example1.html @@ -0,0 +1,31 @@ + + + + + Tipsy - Example 1 + + + + + + + + + + +

Tipsy - Example 1

+ Example Target (with defaults) + + + \ No newline at end of file From 4d86d6d29bb029b09d91dfa608f72cab2202d761 Mon Sep 17 00:00:00 2001 From: leonar15 Date: Wed, 26 Mar 2014 15:21:03 -0700 Subject: [PATCH 2/3] added support for .tipsy(":visible") method to check if the tool tip is visible --- examples/example2.html | 66 +++++++++++++++++++++++++++++++++ src/javascripts/jquery.tipsy.js | 12 +++++- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 examples/example2.html diff --git a/examples/example2.html b/examples/example2.html new file mode 100644 index 0000000..972d307 --- /dev/null +++ b/examples/example2.html @@ -0,0 +1,66 @@ + + + + + Tipsy - Example 2 + + + + + + + + + + +

Tipsy - Example 2

+

+ This tipsy example covers the usage of .tipsy("visible") +

+ Example Target (click me to toggle tipsy) +
+
+

+ + +

+ + \ No newline at end of file diff --git a/src/javascripts/jquery.tipsy.js b/src/javascripts/jquery.tipsy.js index f95c063..4e9e775 100644 --- a/src/javascripts/jquery.tipsy.js +++ b/src/javascripts/jquery.tipsy.js @@ -88,6 +88,12 @@ } }, + visible: function() { + return (typeof this.$tip != 'undefined') + && this.$tip.height() + && this.$tip.width(); + }, + fixTitle: function() { var $e = this.$element; if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') { @@ -131,10 +137,12 @@ $.fn.tipsy = function(options) { + var tipsy = this.data('tipsy'); if (options === true) { - return this.data('tipsy'); + return tipsy; + } else if (options == ':visible') { + return tipsy.visible(); } else if (typeof options == 'string') { - var tipsy = this.data('tipsy'); if (tipsy) tipsy[options](); return this; } From 4589b6f7aae73f15d3b3638eebc6d983aea1a0f7 Mon Sep 17 00:00:00 2001 From: leonar15 Date: Wed, 26 Mar 2014 16:35:00 -0700 Subject: [PATCH 3/3] improved :visible check and updated example2 --- examples/example2.html | 3 ++- src/javascripts/jquery.tipsy.js | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/example2.html b/examples/example2.html index 972d307..fec1654 100644 --- a/examples/example2.html +++ b/examples/example2.html @@ -13,7 +13,8 @@ $target .tipsy({ - trigger: "manual" + trigger: "manual", + fade : true }) .on('click', function(){ var $this = $(this); diff --git a/src/javascripts/jquery.tipsy.js b/src/javascripts/jquery.tipsy.js index 4e9e775..6050f63 100644 --- a/src/javascripts/jquery.tipsy.js +++ b/src/javascripts/jquery.tipsy.js @@ -89,9 +89,13 @@ }, visible: function() { - return (typeof this.$tip != 'undefined') - && this.$tip.height() - && this.$tip.width(); + if (typeof this.$tip == 'undefined') { + return false; + } + + return this.$tip.css('opacity') != 0 + && this.$tip.height() + && this.$tip.width(); }, fixTitle: function() {