Ho fatto alcuni test prova cosi e dovrebbe andareOriginariamente inviato da elixir1349
Allora..l'ho leggermente modificato a causa della chiusura-apertura-apertura..si apriva 2 volte non so perchè, jo tolto una parte del tuo codice dopo else
Il problema è che anche così mi si aprono entrambi gli spoiler!! Come posso rimediare?codice:$('.OS').click(function(e){ if(!$(e.target).parents('.details').length){ if($(".details").is(":visible")) { $(".details").not(":hidden").hide("slow"); return true; } else { $(".details").show("slow"); return false; } } });
La cosa buona è che cliccato dentro lo spoiler non si chiude.
Guarda qui:
http://chilp.it/aa1d9b
codice:$(document).ready(function(){ $(".nonjs").removeAttr( "href"); //href is needed for users without JS $('.OS').click(function(e){ if(!$(e.target).parents('.details').length){ if($(this).find('.details').is(":visible")) { $(this).find('.details').not(":hidden").hide("slow"); return true; } else { $(this).find('.details').show("slow"); return false; } } }); });