jQuery tipsy click event not working
I am trying to build a click event on images which has a tipsy hover caption however the click event is not working in IE (8 only one tested).
Below is in a PHP while loop to create a tooltip for each colour element.
$(function(){
$('.colour_tip_<?php echo($f['colour_id']); ?>').tipsy({fallback: "<?php echo($f['colour']); ?>", gravity: 's'});
});
Its like the caption is blocking the click event.
Any help开发者_如何转开发 is appreciated.
$(".colour_tip_<?php echo($f['colour_id']); ?>").attr('title','What ever text you want');
$(".colour_tip_<?php echo($f['colour_id']); ?>").tipsy({trigger: 'manual', gravity: 'n'});
Then when you know you have to show this tipsy, like onClick on those events, define onclick function of those images as:
$(".colour_tip_<?php echo($f['colour_id']); ?>").tipsy("show");
//also if you need to hide them on click/onfocus you can use this:
//$(".colour_tip_<?php echo($f['colour_id']); ?>").attr('onclick', "hideTipsyOnMe(this);");
where hideTipsyOnMe is
function hideTipsyOnMe(div){
$(div).tipsy('hide');
}
ANother way is to have a tipsy when you hover over that element (which I think is not what you want here but still),
Just put a title tag on your element on which you need a tipsy on hover and use
$(".mark_icon a").tipsy({live:true});
//works for me in all browsers
精彩评论