首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >qtip live()支持

qtip live()支持
EN

Stack Overflow用户
提问于 2010-12-16 00:18:29
回答 2查看 3.5K关注 0票数 2

我正在使用jQuery AJAX调用加载页面的一部分,并希望在该部分中使用qTips。通常,在通过AJAX加载jQuery函数时,需要使用.live()函数。有没有一种方法可以使用.live()连接qTip,或者是否有qTip的等价物?

我听说qTip 2.0将提供这种支持,但我不认为2.0已经准备好了。

有没有人有变通的办法?

下面是我认为应该可以工作但似乎不能工作的完整代码:

代码语言:javascript
复制
$('.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加载表单。

EN

回答 2

Stack Overflow用户

发布于 2010-12-16 05:41:57

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

您还可以在单击时附加之前,尝试检查qtip是否已附加到所单击的对象。Firebug会告诉你要检查什么。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4452188

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档