javascript - Jquery fancybox 选项不起作用

标签 javascript jquery fancybox

这是一些代码,该框显示正常,但所有选项似乎都不会影响任何内容!

弹出 HTML:

<div id="fb-pop">
    <div id="fb-content">
        <div class="fb-txt">
            <strong>Have you considered buying a license for Construct 2?</strong><br /><br />
            It comes with more lots more features and possibilities.  Make better games!<br />
            <span class="ti">(And no more annoying messages!)</span>
        </div>
        <a class="get" href="REPLACEME" title="Your support is appreciated!"></a><br />
        <a class="no-thx" href="javascript:void(0)" onclick="$.fancybox.close()" title="Are you sure?  Upgrading your license helps support Construct 2's development!">No thanks, maybe next time!</a>
    </div>
</div>
<a href="#fb-content" id="autostart"></a> 

页面底部的JS:

jQuery(document).ready(function () {

    $("a#autostart").fancybox({
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 200,
        'overlayShow': false
    });

    $("a#autostart").fancybox().trigger('click');

无论我在 javascript 中添加什么选项/属性,似乎都没有改变!它在所有浏览器中的行为方式仍然完全相同。

我试图做到这一点,以便背景叠加层在单击时不会关闭 fancybox(因此用户必须单击 X 或关闭链接)。

最佳答案

你确定不是:

$("a#autostart").trigger('click');

而不是:

$("a#autostart").fancybox().trigger('click');

关于javascript - Jquery fancybox 选项不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7959855/

相关文章:

javascript - 使用Async/Await调用Async函数给对象中的key赋值

javascript - 要显示在可滚动 div 内的绝对定位元素的问题

javascript - JS : How to print elements in a for loop with distinct #ids?

javascript - 我如何更改此 JavaScript?

jquery - 花式框位置绝对左上角

javascript - React 18 不再支持 Warning::ReactDOM.render。请改用 createRoot

javascript - 在同一页面中处理多个表单

c# - JQuery 选项卡控件 : load gridview

javascript - Fancybox 加载,但不包含任何图像,即使我很确定图像在正确的位置

asp.net - 在 ASP.NET 中使用母版页时使用 JQuery 的正确方法是什么?