您必须在 ajax 调用后重新绑定工具提示。
$( document ).ajaxStop( function() {
$('[title]').colorTip({color:'yellow'});
});
或者按照 jbabey 的建议,您可以使用完整的回调来重新绑定工具提示(此处的简化版本):
$(
function(){
// Get a reference to the content div (into which we will load content).
var jContent = $( "#content" );
// Hook up link click events to load content.
$( "a" ).click(
function( objEvent ){
var jLink = $( this );
// Clear status list.
$( "#ajax-status" ).empty();
// Launch AJAX request.
$.ajax(
{
// The link we are accessing.
url: jLink.attr( "href" ),
// The type of request.
type: "get",
// The type of data that is getting returned.
dataType: "html",
complete: function(){
console.log("finalized ajax request");
//re-bind the tooltip
$('[title]').colorTip({color:'yellow'});
},
success: function( strData ){
console.log("ajax success");
console.log(strData);
// to something with the received data
jContent.html( strData );
}
}
);
// Prevent default click.
return( false );
}
);
}
);
根据您的评论,我包括以下内容:您还必须确保在页面加载时绑定工具提示:
$( document ).ready( function() {
$('[title]').colorTip({color:'yellow'});
});