我如何延迟这个订阅弹出窗口10秒钟?我不明白错误在哪里..我尝试了不同的代码
<?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; ?>
答案 0 :(得分:0)
你应该这样做:
<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>