I would like a dropdown I created with hidden content to open and expose itself if someone goes to a url with an anchor at the end.
For example if someone is sent a url to "domainname.com/page#!contentwindow1"
I would also like that particular dropdown to open automatically without having to click it.
Here is my code so far...
HTML:
<div class="dropdown_wrapper">
<a href="#!window1" id="window1" class="dropdown">Title 1</a>
<div class="hidden dropdown_content">
<p>Hidden Content for window 1</p>
</div>
</div>
<div class="dropdown_wrapper">
<a href="#!window2" id="window2" class="dropdown">Title 2</a>
<div class="hidden dropdown_content">
<p>Hidden Content for window 2</p>
</div>
</div>
jQuery:
$('.dropdown').click(function(){
if($(this).hasClass('active')){
$(this).removeClass('active');
$(this).next('.dropdown_content').slideUp(300);
}else{
$(this).addClass('active');
$(this).next('.dropdown_content').slideDown(300);
}
});
Upon clicking one of the windows, the url gains the href that was included in the <a>
tag and opens up the content that was hidden with the jQuery.
Question: How can I make it that when I share this url to someone else it will automatically or already be opened once the page loads?