如何粘贴时如何设置来自ajax回调的cluetop工具提示的标题:true?

leo*_*ora 2 ajax jquery title cluetip

我正在使用cluetip插件很棒.我使用Ajax填充插件但我无法在任何地方(在文档或示例中)如何从ajax回调设置标题.

是否从cluetip中支持的ajax更新标题?

更新说明:

因此,下面给出的建议可以创建一个标题,但在这种情况下,关闭按钮不会显示在标题中.见下图.

在此输入图像描述

Sta*_*arx 6

实际上,如果你从一个简单的角度看,这很容易.

首先要注意的是,文档中的所有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)

完成

虽然小提琴可能没有表现出来.我测试了它,它的工作原理.