缩略图淡出时解除Fancybox的绑定 [英] Unbinding Fancybox on thumbnail fade

查看:109
本文介绍了缩略图淡出时解除Fancybox的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对一系列画廊图像使用fancybox.

I am using fancybox on a series of gallery images.

用户可以选择单击一个链接,该链接将淡出某些类别的某些图像.

The user has the option to click a link which fades out certain images of a certain category.

我想对褪色的图像取消Fancybox方法的绑定,但是当它们完全不透明时也要重新绑定.

I want to unbind the Fancybox method on the images that are faded but also re-bind when they are at full opacity.

$("#clientsProjects").delegate("#clientsProjects nav a", "click", function() {

    $("#clientsProjects .current").removeClass("current");

    $(this).parent().addClass("current");

    var $filterClass = $(this).attr("class").split(/\s+/);

    $.each($filterClass, function(index, item){

        if ($filterClass != "all") {

            $("#clientsProjects .workThumbs div:not(." + $filterClass + ")").stop().fadeTo("slow", .2, function() {
                $(this).unbind("click");
            });

            $("#clientsProjects .workThumbs div." + $filterClass).stop().fadeTo("slow", 1);

        } else {

            $("#clientsProjects .workThumbs div").stop().fadeTo("slow", 1);

        }

    });

    return false;

});

推荐答案

您的代码看起来有些疯狂/很长,所以我不会花太多时间检查它;但是,您的问题似乎很简单.

Your code looks a little crazy / long so I'm not going to bother examining it too thoroughly; however your problem seems fairly simple.

在使图像褪色时,还请调用.unbind('click.fb')解除绑定花哨框.

When fading an image additionally call .unbind('click.fb') to unbind fancybox.

并重新应用它;您使用的淡入方法将接受在动画完成时执行的回调函数;在该函数中,您可以再次将fancybox绑定到对象上.

And to re-apply it; the fade in methods you're using will accept a callback function that is executed on completion of the animation; within that function you can then bind fancybox onto the objects again.

这篇关于缩略图淡出时解除Fancybox的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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