I went through this question and realized that click (and touchstart) should work.
@vulcanR, it does not work in your case, because you already have #mobileNavigation as display: none ; Thus, there is no place to trigger an event.
Instead, try the following code and it should work -
$(document).ready(function() { $('#mobileMenuButton').on('click touchstart', function() { if ($('#mobileNavigation').css('opacity') == '0') { $('#mobileNavigation').css('opacity','1'); } else { $('#mobileNavigation').css('opacity','0'); } }); }); });
The reason for this work is that opacity:0 preserves the height and width of the element, while display:none makes the measurements equal to zero, so there is no property for the event. You could also use visibility:hidden , but this does not listen to the click event or any events at all.
source share