差异JQuery 1.4.2→1.4.3足以打破良好的旧图像库†

时间:2011-03-14 00:44:52

标签: javascript jquery debugging version-control jquery-plugins

在exaclty六次尝试之后向原始的auhtor请求一个图像弹出式javascript代码使他的脚本与更新的JQuery库兼容,这六个都是徒劳的,我决定让我在没有他第七次尝试的情况下解决它的时间,并且打捞这完全有效(在我经过多次定制之后)图像弹出脚本。

  

问题:加载JQuery 1.3.2 1.4.2 时有效,但是当JQuery 1.4.3 时1.5.1 已加载。在新版本中,单击缩略图后图像不会放大,而在旧版本中,图像不会放大!

我非常欢迎并非常感谢任何建议/帮助。谢谢!

问题出在这里:

//display content
var displayContent = function(img) {
    if (visible) {
        var newImg = jQuery.extend(true, {}, img);
        resizeImg(newImg);

        var imgWidth = newImg.width;
        var imgHeight = newImg.height;
        var outerWidth = imgWidth + hBound;
        var outerHeight = imgHeight + vBound; 

        $lightbox.stop(true).animate({width:imgWidth, height:(imgHeight + cpHeight),
        left: Math.round(($(window).width() - outerWidth)/2),
        top:Math.round(($(window).height() - outerHeight)/2)}, 
        tranSpeed, 
        function() {
            enableCtrl();
            $innerBox.height(imgHeight);
            $info.html(langArrows + "  " + langImage + " " + (currIndex+1) + "/" + numItems);
            $cpanel.css({top:imgHeight, display:"block"});
            $mainImg.css({width:imgWidth, height:imgHeight})
            .attr("src", newImg.src).animate({opacity:1}, tranSpeed, startTimer);
            showDesc();
        }
        );
    }
}

1 个答案:

答案 0 :(得分:4)

在第336行,将.show()添加到链的末尾。虽然LekisS得到了正确答案,但如果你在那里添加它,它没有被正确隐藏,所以下次你点击图像时,你会看到图像显示为缩略图大小一小段时间。