dan*_*007 2 javascript jquery qtip
我有一个分配给元素的QTip,如下所示:
$('#myDiv').qtip({
show: { when: { event: 'click', } },
hide: { when: { event: 'unfocus' } },
style: {
border: {
width: 5,
radius: 10
},
padding: 10,
textAlign: 'center',
tip: true, // Give it a speech bubble tip with automatic corner detection
name: 'red' // Style it according to the preset 'cream' style
},
position: {
corner: {
tooltip: 'topMiddle', // Use the corner...
target: 'bottomMiddle' // ...and opposite corner
}
},
content: {
text: self.parent('.qtip').html(),
title: { text: 'My Title' }
},
});
Run Code Online (Sandbox Code Playgroud)
在'content'中的'text'下,我试图访问触发此QTip的元素的innerHTML,以便在单击后显示.
但是,self.parent('.qtip').html()
如上所示,我目前的手段不起作用.
这样做的标准方法是什么?谢谢.
我后来找到了这个问题的解决方案.
要访问触发QTip的元素的属性,必须以这种方式构造代码:
$("#container a").each(function() {
$(this).qtip({ // QTip code });
});
Run Code Online (Sandbox Code Playgroud)
这样,可以使用$(this)来访问触发QTip的元素的innerHTML等数据.
归档时间: |
|
查看次数: |
1137 次 |
最近记录: |