简体   繁体   English

延迟订阅弹出jquery

[英]delay subscribe popup jquery

how i can delay this subscribe popup for 10 seconds? 我如何将此订阅弹出窗口延迟10秒钟? i don't understand where is the mistake.. i tried different codes 我不知道错误在哪里。我尝试了不同的代码

    <?php
    if ($this->isActivePopUp() && !Mage::helper('newssubscribers')->isMobile()):
    ?>


<script type="text/javascript">
        $(window).load(function() {

        var delay = 10000; // milliseconds
        }
        });

        <?php if (is_numeric($this->getCookieLifeTime())): ?>
        EsNewsSubscribers.setCookieLiveTime(<?php echo $this->getCookieLifeTime(); ?>);
        <?php endif; ?>
        <?php if ($this->getCookieName()): ?>
        EsNewsSubscribers.setCookieName('<?php echo $this->getCookieName(); ?>');
        <?php endif; ?>
        EsNewsSubscribers.setBaseUrl('<?php echo $this->getBaseUrl(); ?>');

</script>
    <div id="esns_background_layer">example</div>
<?php endif; ?>

You should do this: 你应该做这个:

<script type="text/javascript">
    $(window).load(function() {
       setTimeout("startSubscription()",10000);
    }
    });

    function startSubscription()
    {
        <?php if (is_numeric($this->getCookieLifeTime())): ?>
        EsNewsSubscribers.setCookieLiveTime(<?php echo $this->getCookieLifeTime(); ?>);
        <?php endif; ?>
        <?php if ($this->getCookieName()): ?>
        EsNewsSubscribers.setCookieName('<?php echo $this->getCookieName(); ?>');
        <?php endif; ?>
        EsNewsSubscribers.setBaseUrl('<?php echo $this->getBaseUrl(); ?>');
    }
</script>

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

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