【问题标题】:qtip live() supportqtip live() 支持
【发布时间】:2010-12-15 16:18:28
【问题描述】:

我正在使用 jQuery AJAX 调用加载页面的一部分,并希望在该部分中使用 qTips。通常,当通过 AJAX 加载 jQuery 函数时,您使用 .live() 函数。有没有办法使用.live() 附加一个 qTip 或者有一个等效的 qTip?

我听说 qTip 2.0 将提供此支持,但我认为 2.0 尚未准备好。

有人有解决方法吗?

以下是我认为应该有效但似乎无效的完整代码:

$('.editquestion').live('click', function() {
                $(this).qtip({
                    overwrite:false,
                    content: {
                        url: $(this).attr('href'),
                        data: { id: 5 },
                        method: 'get',
                        title: {
                            text: 'Edit Question',
                            button: 'Close'
                         },
                         cache: false,
                    },
                    position: {
                        target: $(document.body), // Position it via the document body...
                        corner: 'center' // ...at the center of the viewport
                    },
                    show: {
                        ready:true,
                    },
                    hide: false,
                    style: {
                        width: { 
                            max: 550,
                            min: 550
                        },
                        height: {
                            max: 300,
                            min:300
                        },
                        padding: '14px',
                        border: {
                            width: 9,
                            radius: 9,
                            color: '#666666'
                        },
                        name: 'light'
                    },
                    api: {
                        beforeShow: function() {
                            // Fade in the modal "blanket" using the defined show speed
                            $('#qtip-blanket').fadeIn(this.options.show.effect.length);
                        },
                        beforeHide: function() {
                            // Fade out the modal "blanket" using the defined hide speed
                            $('#qtip-blanket').fadeOut(this.options.hide.effect.length);
                        }
                    }
                });
                return false;
            });

编辑:也许我还应该提到 qtip 使用 ajax 加载表单。

【问题讨论】:

    标签: jquery qtip


    【解决方案1】:

    【讨论】:

    • 嗯,感谢您的回复。第一个链接是我见过的。这对我来说很有意义,并且在逻辑上应该有效,但似乎没有。它的行为就好像它正在创建自己的副本。每次我调用 qTip 时,它都会进行更多调用(例如,第一次:1,第二次:2,等等)。第二个链接对我来说没有多大意义。这不是在静态页面上附加 qtips 的正常方式吗?
    【解决方案2】:

    您应该在加载页面的新部分而不是点击时附加 qtip。

    您还可以尝试在附加点击之前检查 qtip 是否已经附加到点击的对象。 Firebug 会告诉您要检查的内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-09
      • 1970-01-01
      • 2019-09-25
      • 1970-01-01
      相关资源
      最近更新 更多