Fancybox doesn't work with jQuery v1.9.0 [ f.browser is undefined / Cannot read property 'msie' ]

前端 未结 4 1593
执笔经年
执笔经年 2020-11-22 03:07

Fancybox breaks with the new jQuery v1.9.0.

It affects both, Fancybox v1.3.4 and below - and - v2.1.3 and below.

The errors shown are :

4条回答
  •  独厮守ぢ
    2020-11-22 03:28

    Global events are also deprecated.

    Here's a patch, which fixes the browser and event issues:

    --- jquery.fancybox-1.3.4.js.orig   2010-11-11 23:31:54.000000000 +0100
    +++ jquery.fancybox-1.3.4.js    2013-03-22 23:25:29.996796800 +0100
    @@ -26,7 +26,9 @@
    
            titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('
    ')[0], { prop: 0 }), - isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest, + isIE = !+"\v1", + + isIE6 = isIE && window.XMLHttpRequest === undefined, /* * Private methods @@ -322,7 +324,7 @@ loading.hide(); if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) { - $.event.trigger('fancybox-cancel'); + $('.fancybox-inline-tmp').trigger('fancybox-cancel'); busy = false; return; @@ -389,7 +391,7 @@ content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish); }; - $.event.trigger('fancybox-change'); + $('.fancybox-inline-tmp').trigger('fancybox-change'); content .empty() @@ -612,7 +614,7 @@ } if (currentOpts.type == 'iframe') { - $('').appendTo(content); + $('').appendTo(content); } wrap.show(); @@ -912,7 +914,7 @@ busy = true; - $.event.trigger('fancybox-cancel'); + $('.fancybox-inline-tmp').trigger('fancybox-cancel'); _abort(); @@ -957,7 +959,7 @@ title.empty().hide(); wrap.hide(); - $.event.trigger('fancybox-cleanup'); + $('.fancybox-inline-tmp, select:not(#fancybox-tmp select)').trigger('fancybox-cleanup'); content.empty();

提交回复
热议问题