fancybox - simulating a mouseclick issue
I am getting 2 different results when invoking fancybox from a click, and a simulated click. The code writes a link into the wrapper, uses that link to trigger the fancybox. That one is fine, it takes all the properties I have set(width, height etc).
The call $("a#surveypop").fancybox().trigger('click');
does not. Is there a way to pass variables through this call?
$(document).ready(function () {
$('#wrapper').append('<a id="surveypop" href="/survey/survey.html"></a>');
$("a#surveypop").fancybox({
'height': 965,
'width': 555,
'overlayOpacity' : 0.6,
'overlayColor' : '#000000',
'scrolling' : "no",
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'type':'iframe'
});
});
fun开发者_开发技巧ction popup_open() {
$("a#surveypop").fancybox().trigger('click');
}
Like Felix Kling (above) mentions, you shouldn't be initializing fancybox again.
All you need to do is simply trigger the link
$("a#surveypop").trigger('click');
Why not just $("a#surveypop").click();
?
You already setup fancybox with your first call. If you call fancybox()
again, you reinitialise it with the default values.
精彩评论