实际上,如果你从一个简单的角度看,这很容易.
首先要注意的是,文档中的所有cluetips,只使用一个标记布局来显示所有提示.每次触发新的cluetip时,它只会更新其标记布局并显示它.
我用这个演示了.所以加价是:
注意:我使用两个cluetips来模拟具有多个cluetips的案例
<a class="title" title="hello" href="http://plugins.learningjquery.com/cluetip/demo/ajax3.html" rel="http://plugins.learningjquery.com/cluetip/demo/ajax3.html">This example</a>
<a class="basic" href="http://plugins.learningjquery.com/cluetip/demo/ajax.html" rel="http://plugins.learningjquery.com/cluetip/demo/ajax.html">Basic</a>
Run Code Online (Sandbox Code Playgroud)
让我们对样式进行一些小改动,使其正确对齐
.cluetip-close { float: right; margin-top: -40px; }
Run Code Online (Sandbox Code Playgroud)
现在,我们的脚本,两个线索提示.
var title;
$('a.title').cluetip({
closePosition: 'top',
sticky: true,
closeText: '<img src="http://plugins.learningjquery.com/cluetip/demo/cross.png" alt="close" width="16" height="16" />Close',
ajaxCache: false,
ajaxSettings: {
success: function(data) {
title = "Your new Title";
$(this).attr("title", title); //just set the title for consistency
}
},
onShow : function(ct,c) {
$(".cluetip-title").text(title); //update the title class with the title
}
});
$('a.basic').cluetip(); //While definning another tip, it is NOT affected by previous one
Run Code Online (Sandbox Code Playgroud)
虽然小提琴可能没有表现出来.我测试了它,它的工作原理.
| 归档时间: |
|
| 查看次数: |
1668 次 |
| 最近记录: |