2

我正在使用 jquery 线索提示插件,并试图弄清楚一旦我通过 ajax 加载新内容后如何删除任何打开的线索提示对话框。我要么被仍然显示在新内容之上的对话框卡住,要么我试图解决这个问题的方法实际上完全删除了所有未来的线索提示对话框。

这是我的代码,感谢您的帮助。

在 dom 准备好时,我如下实例化线索提示。

//activate cluetip
        $('a.jTip').cluetip({
            attribute: 'href',
            cluetipClass: 'jtip',
            arrows: true,
            activation: 'click',
            ajaxCache: false,
            dropShadow: true,
            sticky: true,
            mouseOutClose: false,
            closePosition: 'title'
         });

当我加载新内容时,我有以下代码。我遇到的问题是 $('.cluetip-jtip').empty() 阻止在加载的任何新内容上打开对话框,而destroy函数不会删除任何打开的对话框,而只会破坏当前对象。

        $('.next a').live("click", function(){

            var toLoad = $(this).attr('href');

            var $data = $('#main_body #content');

            $.validationEngine.closePrompt('body'); //close any validation messages
            $data.fadeOut('fast', function(){
                $data.load(toLoad, function(){
                    $data.animate({
                        opacity: 'show'
                    }, 'fast');
                    //reinitialise datepicker and toolip
                    $(".date").date_input();
                    //JT_init();
                    $('.hidden').hide();
                    //scroll to top of form
                    $("html,body").animate({
                        "scrollTop": $('#content').offset().top + "px"
                    });
                    //remove existing instance
                    //$('a.jTip').cluetip('destroy');
                    //remove any opened popups
                    $('.cluetip-jtip').empty();
                    //reinitialise cluetip
                     $('a.jTip').cluetip({
                        attribute: 'href',
                        cluetipClass: 'jtip',
                        arrows: true,
                        activation: 'click',
                        ajaxCache: false,
                        dropShadow: true,
                        sticky: true,
                        mouseOutClose: false,
                        closePosition: 'title'
                    });
                });
            });

            return false;
        });
4

1 回答 1

0

您是否尝试过触发提示以关闭打开的对话框?添加这个而不是使用$('.cluetip-jtip').empty();

$(document).trigger('hideCluetip');
于 2010-04-23T14:01:25.937 回答