My question is how to be able to link to a certain content (e.g. a certain id
(i.c.: #link
), that is inside a jQuery-"Toggler", like the one I have shown below (the jQuery-snippet isn't functional for some reason here, I apologize):
(".toggler").click(function(){$(this).next().slideToggle("slow")}).next().hide()
.toggler{color:orange; text-decoration:underline; margin-top:0px} .toggler:hover{color:orange; cursor:pointer; text-decoration:none} div#toggled{background-color:light-green}
<script src="http://ift.tt/1oMJErh"></script>
I would like to have <a href="#link">a link</a> here, with a destination inside the Toggler. <br><br><hr>
<p class="toggler">Toggle here.</p>
<div id="toggled"><b><i>TOGGLED CONTENT:</i></b> Imagine I would like to have the <span id="link">link-destination</span> inside this Toggled content (the difficulty is successfully arriving here when the Toggler is closed).</div><hr>
So, the problem arises only when the Toggler is closed/hidden, then the link can not arrive anywhere.
What would be needed for this is an automatic opener for the Toggler I guess, so some way of checking whether the link occurs inside the Toggler first. Or is there perhaps a much easier way around this?
Would someone give me any help on how to go about this?
Aucun commentaire:
Enregistrer un commentaire