2

I have a problem with the loads, the method draggable () from the library jquery ui (). I have a site on zend framework 2. But for some reason I can not understand why my inline code is not executed in the tag . Help please!

File:parallax.phtml - layout page(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>

1 Answer 1

3

try to use inlinescript view helper

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

EOT
); ?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.