4

This question already has an answer here:

I need to use jQuery 1.8.3 for some functionality I need but when I use the jQuery update module to go to 1.8 other modules stop working including views. This is obvioulsy not gonna work.

Is there a safe way to implement jQuery 1.8.3 without breaking any other drupal core of module functionality?

Thanks C

marked as duplicate by Clive Mar 19 '13 at 9:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Mar 18 '13 at 15:40

This question came from our site for professional and enthusiast programmers.

5

jQuery can run side by side with another version of jQuery. Try out jQuery Multi module.

Need to use a higher version of jQuery for your module or theme than the one provided by Drupal/jQuery Update?

jQuery Multi allows you to load an extra version of the jQuery library in parallel to Drupal's version, without conflicting with Drupal's version. You can then choose any JavaScript library or files to use the new version of jQuery. No need to alter packaged jQuery plugins!

1

Try to unset Drupal's jquery.js from your template_process_page in your template.php, then replace it with your downloaded version of jquery.

And from views settings, just make views to use another theme than your theme. (It uses seven theme by default)

Just a quick solution came to my mind, hope it helps.

1

You can switch the needed pages to jQuery 1.8 with implementations of hook_library_alter() and hook_module_implements_alter() and let jQuery Update do the dirty work:

/**
 * Implements hook_module_implements_alter().
 */
function MODULE_implements_alter(&$implementations, $hook) {
  if ($hook == 'library_alter') {
    // Move jquery update to the end. This will make sure our hook_library_alter
    // is always called before the jquery_update's one.
    $jquery_update = $implementations['jquery_update'];
    unset($implementations['jquery_update']);
    $implementations['jquery_update'] = $jquery_update;
  }
}

/**
 * Implements hook_library_alter().
 */
function MODULE_library_alter(&$libraries, $module) {
  if (MODULE_page_use_jquery_18()) {
    // Modifying global $conf variable, can be dangerous. Be carefull.
    global $conf;
    $conf['jquery_update_jquery_version'] = '1.8';

  }
}

/**
 * Helper function.
 */
function MODULE_page_use_jquery_18() {
  // Don't use jQuery 1.8 when using admin theme or on views pages.
  return !views_get_page_view() && !(path_is_admin(current_path()) && user_access('view the administration theme'));
}
0

You can also use jQuery update. It's an out of the box module that updates to jQuery 1.5.2/1.7.1/1.8.2, and jQuery UI 1.8.11

Works right after you anable the module.

  • 1
    This breaks drupal core and other modules such as views that depend on 1.5.2 – cybercampbell Mar 19 '13 at 19:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.