我正在使用 jquery qtip ( http://qtip2.com/ )
它工作得很好,我里面有很多带有类的 div
我正在尝试调用这些 div 上的点击函数
小提示:
var tipContent = $('#tip-content').html();
$('#obsglass').qtip({
content: {
text: tipContent
},
show: {
effect: function() {
$(this).fadeTo(500, 1);
},
event:'click'
},
hide: {
effect: function() {
$(this).slideUp();
},
event:'click unfocus'
},
//show: 'click',
//hide: 'click unfocus',
style: {
classes: 'qtip-bootstrap qtip-shadow',
},
position: {
my: 'center left', // Position my top left...
at: 'center right', // at the bottom right of...
target: $('#obsglass') // my target
},
});
点击功能
$(".obsglass-thumbnail").click(function () {
... 单击工具提示中的 div 时未进入此功能
最佳答案
看起来您的元素已通过插件动态添加到 DOM,请尝试使用 event delegation 这里:
$(document.body).on('click','.obsglass-thumbnail',function() {
// Your code here
})
关于jquery - qtip jquery click不调用工具提示内的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23562399/