I have a module and in it I add the js with
if($_GET['q'] == 'workpage') {
drupal_add_js(drupal_get_path('module', 'sb_carousel').'/js/slide.js');
}
problem is it adds it above jqueru which is defined in the .info file. I see there is a ‘weight’ property how do I get my js at the bottom of the js files??
You can set the weight by passing an
$optionsarray into drupal_add_js():Using
weightandscopeyou should be able to ensure that your JS file is the very last outputted in the HTML.UPDATE
Just a thought, you mention that your jQuery file is loaded in from an
.infofile…there’s no need to do that, jQuery is already added in Drupal by default. You can upgrade to jQuery 1.5 with the jQuery Update module but currently there’s no (official) support for any later versions.If you’re loading in a second jQuery file it might be what’s causing the problem in the first place, unless you use
jQuery.noConflict()properly and even then you might still have problems.