Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
small help how can load the file jquery.min.js at the bottom of the page
in drupal 7.x and in 6.x
Comment | File | Size | Author |
---|
Comments
Comment #1
iammeenugupta96 CreditAttribution: iammeenugupta96 commentedBelow code can be used to place the javascript .js file at the bottom of the page:
In template.php file:
<?php
// Used in conjunction with https://gist.github.com/1417914
/**
* Implements hook_preprocess_html().
*/
function THEMENAME_preprocess_html(&$vars) {
$path = drupal_get_path('theme', 'THEMENAME');
drupal_add_js($path . '/js/jquery.min.js', array('scope' => 'footer', 'weight' => -1, 'preprocess' => FALSE));
}
/**
* Implements hook_process_html().
*/
function THEMENAME_process_html(&$vars) {
$vars['foooter'] = drupal_get_js('foooter');
}
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedI'll try to add some ui to the configuration form to be able to load jquery in the header or footer.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedI have added a new option to move all js to the footer, I hope it'll be helpful). Please review.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedChange status of issue.
Comment #5
markhalliwellThis falls outside the scope of what this project should be doing (it's goal is to update jQuery and subsequent jQuery related code, not alter where it all shows up). For something like this, you would be better off using https://www.drupal.org/project/advagg.