I have an FAQ page with all questions in a list. The list only shows the questions. The answers are hidden and slide down when you click on a question.
On other pages there are links to these questions. I need them to open the FAQ page and directly show the answer as well.
I suppose this has something to do with location/targeting, but don't really know how to solve it.
This is the HTML on the FAQ page
<ul>
<li class="#faq1">
<h1 class="question">
This is were the question goes.
</h1>
<div class="answer">
This is were the answer goes, only showing when clicking the question or a link on another page linked to this question.
</div>
</li>
</ul>
This is the jQuery
jQuery(document).ready(function() {
$(".answer").hide();
$(".question").click(function()
{
$(this).next(".answer").slideToggle(500);
});
});
On some other pages I use normal links. When clicking the link, it obviously opens the FAQ page, but it does not toggle the answer.
<a href="faq">This is were the question goes</a>
What can I do to trigger the slideToggle from another page?