0
페이지가로드 될 때마다 툴팁이 완벽하게 작동하지만 데이터가 아약스를 통해 새로 고쳐지면 작동을 멈 춥니 다. 여기qtip2 툴팁을 동적으로 만드는 방법
$(document).ready(function() {
// MAKE SURE YOUR SELECTOR MATCHES SOMETHING IN YOUR HTML!!!
$('.userExtend').each(function() {
$(this).qtip({
content: {
text: function(event, api) {
$.ajax({
url: api.elements.target.attr('data-url') // Use href attribute as URL
})
.then(function(content) {
// Set the tooltip content upon successful retrieval
api.set('content.text', content);
}, function(xhr, status, error) {
// Upon failure... set the tooltip content to error
api.set('content.text', status + ': ' + error);
});
return 'Loading...'; // Set some initial text
}
},
position: {
viewport: $(window)
},
hide: {
fixed: true,
delay: 300
},
style: 'qtip-light'
});
});
});
따르면 qtip2 우리가 http://jsfiddle.net/qTip2/qcwV4/는 동적으로 만들 수 있지만이 코드