我想知道是否有一种方法只在文档准备好时才加载脚本的一部分,我的意思是当所有的css,js和图像都被下载时运行php脚本有点沉重。在jquery文档上准备运行php脚本
在PHP我知道,可以使用一个如果其他但在jQuery上?
可以是:?
<script>
jQuery(document).ready(function($) {
</script>
<?php
$script = $this->getAllItems();
?>
<script>
});
</script>
<div class="page">
<?php echo $this->getChildHtml('header'); ?>
<div class="main-container col2-left-layout">
<div class="main container_16 clearfix">
<div class="col-main grid_16">
<?php echo $this->getChildHtml('top_callout'); ?>
</div>
<div class="col-main grid_16">
<?php echo $this->getChildHtml('breadcrumbs'); ?>
</div>
<div class="col-main grid_12">
<?php echo $this->getChildHtml('global_messages'); ?>
on document ready call content
<?php echo $this->getChildHtml('content'); ?>
</div>
<div class="col-left sidebar grid_4"><?php echo $this->getChildHtml('left'); ?></div>
</div>
</div>
<?php echo $this->getChildHtml('footer'); ?>
<?php echo $this->getChildHtml('before_body_end'); ?>
</div>
任何帮助表示赞赏!
$(window)。加载(fn)将是理想的,因为他的目标是在图像加载后发生事件,你不觉得吗? – PeterKA
@ user3558931良好的通话我更新了我的回答,并引用了您的更新信用。谢谢一堆。 – War10ck