Javascript end of body

  • Hello,


    i have insert my javascript in the end of the body in the template.php file. But if i load the Page the javascript files always at the top of the page.

    How i can change it in pagekit? Any solutions?

  • I mean extra java script.


    I include it on this way:

    PHP
    1. <!-- Load Javascript -->
    2. <?php $view->script('theme', 'theme:js/lecom24.min.js', ['uikit-sticky', 'uikit-lightbox', 'uikit-parallax', 'uikit-datepicker']) ?>
    3. <?php $view->script('particles', 'theme:js/particles.min.js') ?>
    4. <?php $view->script('particles-jquery', 'theme:js/particles.jquery.js') ?>
  • Okay thanks. But with the view method there is no solution? I will try the old school ways. Thanks for your help.

    There is probably some, but well hidden too and at least it make still the same right? Loading a javascript file... So there is no disadvantage at all to use the regular way. Many ways are leading to rome and which one you use is still your decision just inspect your source code and you will see that it renders anyway the same thing + a version coming from symfony component i guess.


    So as i guess you want to speed up slightly your page loading speed which is not a real game changer at all, as pagekit is using this require.js thing to load anyway asynchroniously the js files. That's why i see like almost no difference on two different hoster checked today.


    Regards,


    Fossy


    P.s. in the pagekit templating documentation I could find the info that exactly this view function will put script as css files in the head section. So if you want to change this behavior you have to edit some pagekit core files I guess where this function is declarated, but which I would not recommend to anyone as on any updates those changes will be gone.