2

I have built a Drupal 7 website that contains a mobile theme. What I want to do is run the newest version of Jquery Mobile - http://jquerymobile.com/ which requires Jquery 1.7.1. Drupal by default is using an older version of Jquery.

I want Jquery Mobile to load "last" and be used for all screen elements (it changes the way form elements, the way the page is scrolled etc). I've already excluded a bunch of the default Drupal js and css (that won't be needed in the mobile theme) and if I stick this in the html.tpl.php of my test theme.

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>

It works exactly the way I want it to, but this does not seem like a good Drupal friendly implementation. What is a better implementation of this that will work better with Drupal and reduce risk of conflicts?

I've tried Jquery update http://drupal.org/project/jquery_update/, and jQuery Multi modules http://drupal.org/project/jqmulti, but without modifications the theme won't load (it loads perfectly if I use those 2 lines above).

Also please do not point me to http://drupal.org/project/jquerymobile or to this http://drupal.org/project/mobile_jquery

I have a site using that module and theme and I do not want / desire/ require, the extra functions thqat module works with (plus it uses an old version of jquery mobile) and the theme has lots of issues which make it not work for my purpose.

2

The issue with updating jQuery manually in Drupal is that the potential arises for parts of Drupal core (and contrib modules) to break because of the change in jQuery version. The main benefit of the jQuery Update module is that it corrects the things that break in Drupal core when jQuery is updated.

Thus, your best option is to utilize the 7.x-2.x-dev version of jQuery Update, which includes rudimentary support for jQuery 1.7.x. Keep an eye on the issue queue related to this version so that you can report and/or investigate any issues that may arise in utilizing jQuery 1.7.x in Drupal 7.

  • After enabling jQuery 7.x-2.x-dev and using jQuery 1.7.x the mobile theme does work. I still need to test everything, because this approach upgrades the regular non mobile version to use jQuery 1.7.X as well, so I need to make sure it does not cause any "mission critical" errors. – user1073319 Jul 18 '12 at 7:41

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.