Answer the question
In order to leave comments, you need to log in
How to set js weight for bxslider module in drupal?
https://www.drupal.org/project/bxslider
When opening a page with a slider, js is loaded in the first place. js location in the footer.
No matter how I tried to add weight, nothing changes.
Since the script is loaded before jquery, bxslider doesn't work.
Where can I add magic lines?
<script src="http://masterasevera.ru/sites/all/modules/bxslider/js/bxslider_ths.js?nsc8zw"></script>
<script src="http://masterasevera.ru/sites/all/modules/jquery_update/replace/jquery/1.8/jquery.min.js?v=1.8.3"></script>
Answer the question
In order to leave comments, you need to log in
I moved the $scripts variable to the header in the html.tpl.php theme and it all worked. Strange, of course. Why is the weight not set correctly?
It is possible through
drupal_set_html_head()
or
drupal_add_js()
If through the first option, then something like this:
function mytheme_preprocess_page(&$vars, $hook) {
drupal_set_html_head('<script type="text/javascript" src="path to your script here"></script>');
$vars['head'] .= drupal_get_html_head();
}
function mytheme_preprocess_page(&$variables) {
drupal_add_js(drupal_get_path('theme', 'MYTHEME') . '/js/yourjsfile.js', array(
'scope' => 'header',
'weight' => '15'
));
}
An obvious module bug that got out due to your use of jquery_update.
Specify additional parameters when connecting a JS module
drupal_add_js(
drupal_get_path('module', 'bxslider') . '/js/bxslider_ths.js',
array(
'type' => 'file',
'scope' => 'footer',
'group' => JS_THEME,
'every_page' => FALSE
)
);
по идеи этого должно хватить для изменения веса.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question