Some themes (eg. http://themeforest.net/item/elegantica-responsive-business-drupal-theme/...) load jQuery as one of their theme's script files. InfiniteCarousel.js gets loaded as a module script file, which, by default, come before the theme script files.

jQuery needs to be loaded before infiniteCarousel.js gets loaded or else the back and forward arrows don't work.

Solution is to load infiniteCarousel.js as a theme script, with a big weight.

galleryformatter.module, line 354:

if($num_of_images > 1){
		$options = array(
  		'weight' => 1000, // High number to push this file to the bottom of the list
  		'group' => JS_THEME
		);

    drupal_add_js($modulepath . '/theme/infiniteCarousel.js', $options);
    drupal_add_js($modulepath . '/theme/galleryformatter.js', $options);
}
CommentFileSizeAuthor
#1 1992304-1-load-js-last.patch855 byteskscheirer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kscheirer’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
855 bytes

Here you go, as a patch. Seems like a benign change.

Manuel Garcia’s picture

Issue summary: View changes
Status: Needs review » Closed (works as designed)

Thanks for the report and patch @kscheirer - (and apologies for the total silence here).

Loading jQuery from a theme is not a good practice, and I wouldn't be surprised if it caused issues with other modules...

It's good you opened this so people can find out about it if they suffer from such a theme, but this isn't going to get in sorry.