Link to home
Create AccountLog in
Avatar of smfmetro10
smfmetro10Flag for United States of America

asked on

how do you open a div based on url parameter

Hi

I have some div's that need to be open and closed based on a url parameter.

Is that possible.

Here is my code so far:

<script type="text/javascript">
jQuery(document).ready(function() {
  jQuery(".menu_Specialties").show();
  //toggle the componenet with class msg_body
  jQuery(".heading1").click(function()
  {
    jQuery(this).next(".menu_Specialties").slideToggle(500);
  });
});
</script>

Open in new window

Is there a way to take :  jQuery(".menu_Specialties").show(); and wrap it in a conditional statement?

Thanks!
Avatar of plusone3055
plusone3055
Flag of United States of America image

if url parameter = x 
jQuery(".menu_Specialties").show();
else 
//do nothing 
end if

Open in new window

Avatar of smfmetro10

ASKER

Thanks for the reply!

On one of sections there will be "specialty" as a parameter.

is this close?

<script type="text/javascript">
jQuery(document).ready(function() {
if url parameter = "specialty" 
jQuery(".menu_Specialties").show();
else
jQuery(".menu_Specialties").hide();
end if 
  //toggle the componenet with class msg_body
  jQuery(".heading1").click(function()
  {
    jQuery(this).next(".menu_Specialties").slideToggle(500);
  });
});
</script>

Open in new window

<script type="text/javascript">
jQuery(document).ready(function() {
if url parameter = "specialty" 
jQuery(".menu_Specialties").show();
//toggle the componenet with class msg_body
  jQuery(".heading1").click(function()
  {
    jQuery(this).next(".menu_Specialties").slideToggle(500);
  });

else
jQuery(".menu_Specialties").hide();
end if 
  });
</script>

Open in new window

I know this is a newbie question but Dreamweaver thinks there is a syntax error with this line:

if url parameter = "specialty"
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account