jquery live&的liveQuery [英] jquery live & livequery

查看:82
本文介绍了jquery live&的liveQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery的加载来通过ajax引入缩略图。我希望用户可以将鼠标悬停在裁剪的拇指上,使用 imgPreview插件。如果他们点击它,然后在灯箱中调出完整大小的图像( fancybox )。

I'm using jquery's load to bring in thumbnails via ajax. I'd like to user to be able to hover over the cropped thumb to view a small uncropped version of the image using imgPreview plugin. If they click on it, then bring up the full sized image in a lightbox (fancybox).

对于灯箱,我有:

$("ul#plant_gallery li a").livequery( function(){   
    $(this).fancybox ({ 'overlayOpacity': 0.9, 'overlayColor': '#000', });
});

对于工具提示未剪切的图像悬停,我有:

And for the tooltip uncropped image hover, I have:

$('ul#plant_gallery li a').live('mouseover', function()
{
    if (!$(this).data('init'))
    {
        $(this).data('init', true);
        $(this).imgPreview({imgCSS: { width: 200 }, srcAttr: 'rel'})
        (
            function()
            {

            },

            function()
            {
            }
        );
        $(this).trigger('mouseover');
    }
});

如何将这两者合二为一?我应该使用jquery的live还是livequery?谢谢你的帮助!

How can I combine these two into one? Should I be using either jquery's live or livequery? Thanks for your help!

推荐答案

我认为你不需要将它们结合起来,你尝试过:

I think you don't NEED to combine them, have you tried:

$("ul#plant_gallery li a").live('click', function(){   
    $(this).fancybox ({ 'overlayOpacity': 0.9, 'overlayColor': '#000', });
});

并保留其他功能原样?

这篇关于jquery live&的liveQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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