2

我的负载有问题,库jquery ui()中的方法draggable()。我在 zend 框架 2 上有一个站点。但由于某种原因,我无法理解为什么我的内联代码没有在标签中执行。请帮忙!

文件:parallax.phtml - 布局页面(Application/view/layout/parallax.phtml

<?php echo $this->doctype(); ?>
<html lang="en">

        <head>
            <meta charset="utf-8"/>

            <?php echo $this->headTitle('alfared.zend.ua');?>
            <?php echo $this->headMeta()
                            ->appendName('Content-Type','text/html;charset=utf-8')
                            ->appendName('description','fsdfsafsa')
                            ->appendName('X-UA-Compatible','IE=edge,chrome=1')
                            ->appendName('viewport','width=device-width,initial-scale=1.0')
                            ->appendName('keywords','')?>
        <?php echo $this->headLink()->prependStylesheet($this->basePath() . '/css/parallax.css')
              ->prependStylesheet($this->basePath() . '/css/style.css')
              ->prependStylesheet($this->basePath() . '/css/flexslider.css')
              ->prependStylesheet($this->basePath(). '/css/bootstrap.min.css')
              ->prependStylesheet($this->basePath(). '/css/jquery-ui.css')
        ?>

       <?php echo $this->headScript()
             ->prependFile($this->basePath().'/js/html5.js','text/javascript', array('conditional' => 'lt IE 9'))
       ?>
            <?php $script ="   //<--inline script
                $(function() {
                        $('#draggable').draggable();
                });
         "?>
       <?php echo $this->headScript()->prependFile($this->basePath(). '/js/jquery-1.8.3.js','text/javascript')?>
       <?php echo $this->headScript()->prependFile($this->basePath(). '/js/jquery-ui.js')?>
       <?php echo $this->headScript()->prependScript($script,'text/javascript') ?>
            <style type="text/css">#draggable{
                width: 150px;
                height: 150px;
                padding: 0.5em;
            }</style>
        </head>
4

1 回答 1

3

尝试使用inlinescript 视图助手

<?php echo $this->inlineScript()->appendScript(<<<EOT
$(function() {
   $('#draggable').draggable();
});

EOT
); ?>
于 2012-12-17T22:42:26.420 回答