Hi there,

The plugin already has an onHide option. I just fixed it so that within onHide's anonymous function "this" will be the invoking element.

so, your additional option would be :

  onHide: function() {
    $(this).parent().removeClass('selectedCell');
  })

You can grab the updated plugin on GitHub:

http://github.com/kswedberg/jquery-cluetip/tree/master

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Apr 16, 2009, at 1:51 PM, tatlar wrote:


Hi there,

I am using Karl's clueTip plugin in a table. When the user clicks a
link in the table, the clueTip pops up, and the CSS of the table cell
changes using the addClass method (adds a class called
'selectedCell'). This is all well and groovy, but what I want to do in
addition, is that when the user closes the clueTip window, the CSS of
the selected table cell reverts to its previous class. I was looking
for an onClose in the clueTip API options list and could not find
one.

Does anyone know how I could achieve this desired behavior? What I
have right now is that when the user clicks one cell all the current
table cells are reset (have the class removed) and then a class is
applied ('selectedCell'). When another a link is clicked in the table,
all the current table cells with that class have it removed, and the
newly clicked cell has the class applied:

$("a.jTip").click( function() {
   $('table tbody tr td').removeClass('selectedCell');
   $(this).parent().addClass('selectedCell');
}

clueTip is called thus:

$("a.jTip").cluetip({
   cluetipClass: 'jtip',
   arrows: true,
   hoverIntent: false,
   mouseOutClose: true,
   sticky: true,
   activation: 'click',
   splitTitle: '|',
   closeText: 'X',
   closePosition: 'title',
   tracking: true,
   showTitle: true
}) ;

I want to add another option (in pseudo-code):
   onClose: function(e) {
       e.parent().removeClass('selectedCell')
   }

Is this worth modifying the plugin for? Am I even going about this the
right way? Thanks in advance.

Reply via email to