Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event to enter function #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
14 changes: 13 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ browser window. It is completely customizable as well via CSS.

This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
http://www.gnu.org/licenses/gpl.html

-----------------------------------------------------------

Updated `enter` function so that caller event is passed along from hover, focus and click eg,

$("#selector").tipTip({
delay: 25,
enter: function(event) {
var selectedElem = event.target;
// ...
}
});
18 changes: 10 additions & 8 deletions jquery.tipTip.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* code.drewwilson.com/entry/tiptip-jquery-plugin
*
* Version 1.3 - Updated: Mar. 23, 2010
* - Updated: Apr. 3, 2012
* https://github.com/pebblecode/TipTip
*
* This Plug-In will create a custom tooltip to replace the default
* browser tooltip. It is extremely lightweight and very smart in
Expand Down Expand Up @@ -63,8 +65,8 @@
var timeout = false;

if(opts.activation == "hover"){
org_elem.hover(function(){
active_tiptip();
org_elem.hover(function(event){
active_tiptip(event);
}, function(){
if(!opts.keepAlive){
deactive_tiptip();
Expand All @@ -76,14 +78,14 @@
});
}
} else if(opts.activation == "focus"){
org_elem.focus(function(){
active_tiptip();
org_elem.focus(function(event){
active_tiptip(event);
}).blur(function(){
deactive_tiptip();
});
} else if(opts.activation == "click"){
org_elem.click(function(){
active_tiptip();
org_elem.click(function(event){
active_tiptip(event);
return false;
}).hover(function(){},function(){
if(!opts.keepAlive){
Expand All @@ -97,8 +99,8 @@
}
}

function active_tiptip(){
opts.enter.call(this);
function active_tiptip(callerEvent){
opts.enter.call(this, callerEvent);
tiptip_content.html(org_title);
tiptip_holder.hide().removeAttr("class").css("margin","0");
tiptip_arrow.removeAttr("style");
Expand Down
4 changes: 3 additions & 1 deletion jquery.tipTip.minified.js

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