Good morning, I've been struggling with the jQuery and iOS click events. I have tried several solutions, but they do not work. The first one that I tried was to add the cursor type to "pointer" to the elements in which I have the events. But it does not work.
.clickeable {
cursor: pointer;
}
Then implement the detection of the iOS device and change the events from click to touchstart
var user_agent = navigator.userAgent.toLowerCase();
var event = user_agent.match(/(iphone|ipod|ipad)/) ? "touchstart" : "click";
$("#menu-toggle").bind(event,function(e) {
e.preventDefault();
$('#menu-toggle').tooltip('hide');
$("#wrapper").toggleClass("toggled");
$("#menubtn")
});
This only operated the menu button, but other events do not work. Like this:
$('.animadoespecial').bind(event,function (event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top -100
}, 500);
});
I also tried adding the onClick attribute, but nothing works.
$('#menu-toggle').attr('onclick', '');
What could it be?