简体   繁体   English

fancybox div中的本地链接不起作用

[英]Local links in a fancybox div not working

Hidden div for Fancybox (v2) usage: Fancybox(v2)用法的隐藏div

<div id="embargomsg" style="display:none">
    <h1 class="entry-title">You Can't Use That Yet</h1>
    <p>That's the special stuff.</p>
    <h2 class="pitch">New to the Site?</h2>
    <p class="pitch"><a class="button secondary promo" href="/register" target="_top"><span>Get Started Today</span></a></p>
    <h2 class="pitch">Already Registered?</h2>
    <p class="pitch"><a class="button secondary action" href="/login" target="_top"><span>Log In</span></a></p>
</div><!-- #embargomsg -->

Various links elsewhere in the page with a class of authctrl should open the fancybox... 页面其他地方具有authctrl类的各种链接应打开fancybox。

<a class="authctrl" href="/specialstuff1">Special Stuff</a>
<a class="authctrl" href="/specialstuff2">Some Other Special Stuff</a>

... using this function: ...使用此功能:

$('.authctrl').click(function(e){
    e.preventDefault();
    $('#embargomsg').fancybox({
    closeClick : false
    }).trigger('click');
});

... but when either of the .authctrl links are clicked, the Fancybox seems to just quickly close and reopen. ...但是当单击任何一个.authctrl链接时,Fancybox似乎只是快速关闭并重新打开。 I tried adding closeClick: false to no avail. 我尝试添加closeClick: false无济于事。

Does $('#embargomsg') have an href? $('#embargomsg')是否具有href?

$('.authctrl').click(function(e){
    e.preventDefault();
    $('#embargomsg').trigger('click');
});

$('#embargomsg').fancybox({
    closeClick : false
});

provide some markup please. 请提供一些标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM