-1

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

6
  • never run two different type of jquery version instal jquery update module then try it Commented Oct 7, 2015 at 9:19
  • i've alredy try, but if i run responsive bartik with jQuery 1.7 page refresh will broke
    – Michele S
    Commented Oct 7, 2015 at 9:32
  • How did you add/insert the jQuery mobile 1.4.5 JS file (library)?
    – No Sssweat
    Commented Oct 7, 2015 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
    Commented Oct 7, 2015 at 10:13
  • Is your jquery update module the latest version of the module? try with jquery 1.10
    – No Sssweat
    Commented Oct 7, 2015 at 10:29

2 Answers 2

0

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 ($) {

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

})(jQuery);
4
  • updated answer.
    – No Sssweat
    Commented Oct 7, 2015 at 11:05
  • the problem it's not the code but jQuery compatibility
    – Michele S
    Commented Oct 7, 2015 at 14:31
  • @MicheleS did you give my code a try? won't hurt...
    – No Sssweat
    Commented Oct 8, 2015 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
    Commented Oct 8, 2015 at 9:14
0

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 and acknowledge you have read our privacy policy.

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