0

This is just a simple question I have. I'm most interested in seeing what others are doing to use the latest version of jQuery in themes.

The reason for this is that some of the best jQuery plugins I use require much later versions of jQuery than what Drupal comes with.

I have tried the update jquery module but it is not as good for Drupal 6 sites.

Is there another way outside of adding your own version of jQuery. Then once you have it finding and replacing jQuery with something like myQuery and sticking myQuery.noConflict() at the end? And then once this is done rewriting plugins to work with myQuery?

  • 3
    why is the jquery_update module not working for you? is it because the version of jquery is still to old for your purposes? – schnippy Apr 18 '12 at 19:42
  • this is correct, yes. – Kevin Apr 20 '12 at 22:27
  • Check the dev branch of jquery_update, it might have a newer version of jQuery available, but might also break core/contrib JavaScript. So if you get errors or missing fields on forms try changing jquery_update's jQuery version to previous ones. – jhr Jan 23 '13 at 22:17
3

In my opinion the best solution is to replace drupal jQuery with the latest jQuery only on the pages where you really need it. If you go on with newest jQuery many of drupal out of the box functionality will be broken.

You can remove native jquery like in the code snippet below only on certain pages that meet your conditions:

function MYTHEME_preprocess_page(&$variables, $arg, $delta) {
  if(YOUR CONDITION HERE) {
    $scripts = drupal_add_js();
    unset($scripts['core']['PATH TO DRUPAL JQUERY']);
    $variables['scripts'] = drupal_get_js('header', $scripts);
  }
}

to add your newest jquery file you can use drupal_add_js('path to yor newest jquery') function.

0

This page http://drupal.org/node/1058168 should answer all your questions. Although Alex has provided probably the best option for Drupal 6 sites.

In Drupal 7, using hook_js_alter() with a separate admin theme is what I would do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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