javascript - jQuery: Trigger help -


i'm using cluetip jquery plugin.

i'm trying add own close button. the jquery i'm trying call is:

 $(document).bind('hidecluetip', function(e) {   cluetipclose(); }); 

there many references cluetipclose() through code , button jquery inserts uses , works function far i'm aware works fine.

i'm trying trigger using

$('a.close-cluetip').trigger('hidecluetip'); 

i've created link:

<a href="#" class="close-cluetip">close</a> 

but isn't doing anything.

am calling incorrectly?

the problem here in cluetip plugin, function cluetipclose() inside closure, have no access unless you're inside closure (i.e. inside plugin's code). i've gotta admit, plugin doesn't seem set extensible. if made function accessible via "cluetip" object set each element uses it, you'd able add jquery method end of closure this:

$.fn.cluetipclose = function() {     return this.each(function() {         var thiscluetip = findcluetipobj(this);          if (thiscluetip)             thiscluetip.cluetipclose();     }); }; 

but have unfortunate luck of not being able easily. looks guy wrote jquery plugin non-oo code inside of closure. poor you.

now on plus side, seems plugin running code directly after instantiates cluetipclose() function. have tried doing code:

$('a.close-cluetip').trigger('hidecluetip'); 

without redeclaring document hidecluetip bind? think should work.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -