Drupal - Add JavaScript at the bottom of a page

I think you can do it with drupal_add_js(); it seems that the scope key option is your friend!


In your theme's html.tpl.php there is a line <?php print $scripts; ?>.

That's the line that prints out the javascript in your page.

You can move it around anywhere you like, for example, place it after everything else, just before the closing body tag to have all your scripts load at the bottom.


You can try adding the file like this:

drupal_add_js('sites/all/themes/themname/js/skrollr.js', array('scope'=>'footer'));

Tags:

Javascript

7