在jQuery工具提示函数中添加链接 [英] Add a link inside jQuery tooltip function

查看:56
本文介绍了在jQuery工具提示函数中添加链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经寻找了一段时间,也许我没有使用正确的术语,但是我试图找出如何在jQuery工具提示中放置一个链接,因此当它弹出时,我可以显示里面有一个菜单.我可以直接在标题中写出链接,例如title="<a href=""></a>">

I have been looking for a while, and maybe I'm not using the right terminology, but I'm trying to find out how to put a link inside of the jQuery tooltip, so when it pops up, I can display a menu in it. Can I just write the link out in the title like title="<a href=""></a>">

这是我当前的提示信息

      $(function() {
        $( document ).tooltip({
          position: {
            my: "center bottom-20",
            at: "center top",
            using: function( position, feedback ) {
              $( this ).css( position );
              $( "<div>" )
                .addClass( "arrow" )
                .addClass( feedback.vertical )
                .addClass( feedback.horizontal )
                .appendTo( this );
            }
          }
        });
      });

推荐答案

如果要在工具提示中动态插入内容,可以订阅工具提示的打开"事件.

If you want to dynamically insert content to the tooltip you can subscribe to the "open" event of the tooltip.

http://jsfiddle.net/PagNg/

示例:-

$( "a" ).tooltip({
  open: function( event, ui ) {
      $(ui.tooltip).append('<a href="http:\\www.google.com">google</a>');
  }
});

这篇关于在jQuery工具提示函数中添加链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆