开发者

jquery live & livequery

开发者 https://www.devze.com 2022-12-14 03:07 出处:网络
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

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).

For the lightbox, I have:

$("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');
    }
});

How ca开发者_开发技巧n 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', });
});

And leaving the other function as it is?

0

精彩评论

暂无评论...
验证码 换一张
取 消