I'm using drupal 7 and trying to develop some mobile menu effect. I've read a lot of discussion so i've install jQuery multi so my drupal run in back-end jQuery 1.5 and in front-end run jQuery 1.11.3. I've also insert jQuery mobile 1.4.5 to manage mobile touch events but for what i understand this will not execute thi is my code

jQuery("#page").on("swipe",function(){ if($(window).width()<=900){ $("#nice-menu-1").children("li").children("ul").css({display: 'block', visibility: 'visible'}); } })(jq1113)

It's not a js code problem but a library loading for what i know
i've got some error like this:
Uncaught TypeError: a.mobile.document.on is not a function Uncaught TypeError: jQuery(...).on is not a function
Could someone helo me? thank you

  • never run two different type of jquery version instal jquery update module then try it – Adeel Nawaz Oct 7 '15 at 9:19
  • i've alredy try, but if i run responsive bartik with jQuery 1.7 page refresh will broke – Michele S Oct 7 '15 at 9:32
  • How did you add/insert the jQuery mobile 1.4.5 JS file (library)? – No Sssweat Oct 7 '15 at 9:57
  • i've add it to html.tpl.php <script ...></script> , and it work if i update with jQuery update module to 1.7, but broke drupal core so i'm searching an alternative – Michele S Oct 7 '15 at 10:13
  • Is your jquery update module the latest version of the module? try with jquery 1.10 – No Sssweat Oct 7 '15 at 10:29

I see there are some errors in your code, such as a missing open curly bracket for your if statement and few others.

Try this:

(function ($) {

     $(document).ready(function( $ ) {
         if($(window).width()<=900) {
         $("#nice-menu-1").children("li").children("ul").css({"display": "block", "visibility": "visible"});

  • updated answer. – No Sssweat Oct 7 '15 at 11:05
  • the problem it's not the code but jQuery compatibility – Michele S Oct 7 '15 at 14:31
  • @MicheleS did you give my code a try? won't hurt... – No Sssweat Oct 8 '15 at 0:03
  • Yes, i try, but was not that the problem, i've partially solved by adding <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" /> This solve js problem but also make my desktop layout similar to mobile and thats not good – Michele S Oct 8 '15 at 9:14

I've finally solve by using jQuery Mobile Builder selecting only mobile events so it reduce collision

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.