开发者

ModalBox - FancyBox Plugin issue on Google Chrome - Uncaught TypeError: url has no method 'click'

I tried the click method to auto load modal Box, works in FF and IE but in chrome it throws me below error -

Uncaught TypeError: Object http://my_url?ml=1 has no method 'click'

First i initialize fancy box using init method. Then, I have two fancy Box links, i am trying to invoke second link using :

 jQuery(document).ready(function(){
     jQuery("a.modalizer_link")[1].click();
 });

Anybody any Suggestions on getting it to work in chrome?

开发者_如何学运维Thanks


AFAICT, FancyBox adds a method to elements selected by jQuery (by extending the global jQuery selector), which allows you to start a FancyBox programatically.

$("a.modalizer_link")[1].fancybox({
    'transitionIn'  :   'elastic',
    'transitionOut' :   'elastic',
    'speedIn'       :   600, 
    'speedOut'      :   200, 
    'overlayShow'   :   false
});

Adapted from the official FancyBox documentation here.

I would advise against attempting to trigger an event in this case, when what you really want to do is open the modal box.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜