我有一个load的问题,来自库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>
答案 0 :(得分:3)
<?php echo $this->inlineScript()->appendScript(<<<EOT
$(function() {
$('#draggable').draggable();
});
EOT
); ?>