I have some buttons that when clicking on them, load a text. It works on my computer and on Android but not on Iphone ( it takes me to the top of the page ). This is the code I use.
<script type="text/javascript">
$(document).ready(function(event) {
$('#btn-servicios-1').click(mostrarServicios1);
$('#cerrar-servicios-1').click(cerrarServicios1);
$('#btn-servicios-2').click(mostrarServicios2);
$('#cerrar-servicios-2').click(cerrarServicios2);
$('#btn-servicios-3').click(mostrarServicios3);
$('#cerrar-servicios-3').click(cerrarServicios3);
$('#btn-servicios-4').click(mostrarServicios4);
$('#cerrar-servicios-4').click(cerrarServicios4);
});
function cerrarServicios1(event) {
/*event.preventDefault();*/
$("#contenido-servicios-1").hide();
return false;
}
function mostrarServicios1(event) {
/*event.preventDefault();*/
$("#contenido-servicios-1").css("display", "-webkit-box");
$("#contenido-servicios-1").css("display", "-ms-flexbox");
$("#contenido-servicios-1").css("display", "-webkit-flex");
$("#contenido-servicios-1").css("display", "flex");
$("#contenido-servicios-1").css("flex-wrap", "wrap");
return false;
}
function cerrarServicios2(event) {
/*event.preventDefault();*/
$("#contenido-servicios-2").hide();
return false;
}
function mostrarServicios2(event) {
/*event.preventDefault();*/
$("#contenido-servicios-2").css("display", "-webkit-box");
$("#contenido-servicios-2").css("display", "-ms-flexbox");
$("#contenido-servicios-2").css("display", "-webkit-flex");
$("#contenido-servicios-2").css("display", "flex");
$("#contenido-servicios-2").css("flex-wrap", "wrap");
return false;
}
function cerrarServicios3(event) {
/*event.preventDefault();*/
$("#contenido-servicios-3").hide();
return false;
}
function mostrarServicios3(event) {
/*event.preventDefault();*/
$("#contenido-servicios-3").css("display", "-webkit-box");
$("#contenido-servicios-3").css("display", "-ms-flexbox");
$("#contenido-servicios-3").css("display", "-webkit-flex");
$("#contenido-servicios-3").css("display", "flex");
$("#contenido-servicios-3").css("flex-wrap", "wrap");
return false;
}
function cerrarServicios4(event) {
/*event.preventDefault();*/
$("#contenido-servicios-4").hide();
return false;
}
function mostrarServicios4(event) {
/*event.preventDefault();*/
$("#contenido-servicios-4").css("display", "-webkit-box");
$("#contenido-servicios-4").css("display", "-ms-flexbox");
$("#contenido-servicios-4").css("display", "-webkit-flex");
$("#contenido-servicios-4").css("display", "flex");
$("#contenido-servicios-4").css("flex-wrap", "wrap");
return false;
}
</script>
I have tried both with preventDefault and with return false, but nothing.
PS: it seems that if the iPhone loads the web and gives it to 'desktop mode', if it works, but in 'Normal Mode' so to speak, no.