Can anyone tell me whats wrong with my code? The qtip works ok on mouseover the first time, but the second time it shows 2 tooltips, one with what ever I have in the title attribute and another one on top of that one that's empty.
$(document).ready(function() {
$(".tooltip").bind('mouseover', function() {
$(this).qtip({
overwrite: false,
show: {
ready: true
}
});
});
});
Try setting overwrite
to true
Determines if, when the .qtip() method is called on an element with a qTip already present, the new one overrides (i.e. destroys) the old one. By default this is true.
ie if set to false, a new qtip is created each mouseover
.
You don't have to bind mouseover. qtip does that.
$(document).ready(function () {
$('.tooltip').qtip({
overwrite: true,
show: {
ready: true
}
});
});
EDIT: You didn't tell anything about ajax. So this should work(jsFiddle case);
$(document).ready(function() {
$(".tooltip").bind('mouseover', function() {
var $this = $(this);
if($this.data('qtip') == null) {
$this.qtip({
overwrite: true,
show: {
ready: true
}
});
}
});
});