1

I am creating a script that will show drop down menus under my navigation items on a Desktop, Ipad or tablet.

Right now the dropdowns are showing when I test this on a desktop, but not on an Ipad.

I tried adding alerts to see if they show when I tap on the navigation items on an Ipad, and they did. So I'm wondering if there is an issue with ToggleClass on an Ipad?

Why does this code not work on an Ipad?

 $('body').on('click touchstart','li.dropdown-control > a',function(event){
   event.preventDefault()
     var nextSibling = $(this).next();
       nextSibling.toggleClass('dropped');  
       $('.dropped').not(nextSibling).removeClass('dropped'); 
  }); 
user1836025
  • 209
  • 4
  • 14
  • Be careful with using `event.preventDefault()` on iPad it's tricky. Other thing might be `nextSibling` is it a node indeed and last not sure about it but are you sure jQuery supports `touchstart` event listener? – kidwon Jan 29 '13 at 16:26

1 Answers1

0

I'm an idiot, the script was fine. It was my tablet specific CSS that was keeping it from showing up.

user1836025
  • 209
  • 4
  • 14