开发者

jQuery: Fancybox produces a loop of errors in chrome using ajax

开发者 https://www.devze.com 2023-03-16 17:44 出处:网络
This my code: <a href=\"url\" 开发者_开发技巧class=\"fancybox\">Text</a> jQuery(document).ready(function() {

This my code:

<a href="url" 开发者_开发技巧class="fancybox">Text</a>
jQuery(document).ready(function() {
    jQuery(".fancybox").fancybox({
        'overlayShow': true,
        'hideOnContentClick': false
    });
});

The box is displayed, the content is loaded but in the error console of chrome "Uncaught TypeError: Cannot call method 'width' of undefined".

The box can be closed but then it is not possible to open it again.

I am using FB 1.3.4 and jQuery 1.5.1.


Ive had this same problem before and the cause was that I was loading the fancybox.1.3.4.js file inside of the file that was getting loaded by fancybox in the first place.

If you are doing this as well, it will be the problem. Otherwise I do not know.


Problem is caused by your code where you did not mention of using iframe.

You will have to declare like this:

$('a[rel^=iframe_group]').fancybox({
    'autoDimensions'    : false,
    'autoScale'     : false,    
    'width'         : '50%',
    'height'        : '80%',
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    **'type'            : 'iframe'**
}); 
0

精彩评论

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

关注公众号