iOS y haciendo clic
Frecuentes
Visto 40 equipos
0
Tengo esta estructura
<div class="photo">
<a href=some_url>
<img src=.. />
</a>
</div>
on android if I touch the .photo
it would click on the anchor, but on ios the behavior seems inconsistent (ios 7), sometimes it works sometimes it doesn't, I haven't found where I should touch so it would click yet
Is there a special handling/workaround to handle this kind of scenario?
1 Respuestas
0
YES, the workaround is to put the div inside the anchor!
as you updated your question, my answer is still the same, take the anchor outside of the div!
ACTUALIZACIÓN:
let's say you have this:
<div id="body">
<a href="#" id="popup"><img src="something"></a>
<a href="#" id="remove"><img src="something"></a>
</div>
I think you want it to trigger popup when clicked on #body but not when clicked on #remove!
if so this is the jquery code:
$('#body').on('tap', function(clickPosition){
if (!$('#remove').is(clickPosition.target) && $('#remove').has(clickPosition.target).length === 0){
//do remove code
}
else{
// trigger the #popup in here
}
};
Respondido el 12 de junio de 14 a las 10:06
is there another? I've simplified the question but in reality I have more than the anchor inside the parent div - Nick Ginanto
let me see if I got it right, you want the anchor to be triggered when you touch the div, right? - Amin Yafari
I think not. Div can have more elements than one anchor. - niquel
Basically its a wrapper with an img inside an anchor (so if you click the img it would click) but the other nodes in the wrapper are other anchors for deleting the img for instance) - Nick Ginanto
for IOS there are some problems with click function try using, on('tap',function(){});
- Amin Yafari
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript jquery ios touch or haz tu propia pregunta.
an img inside an anchor inside a div - Nick Ginanto