show/hide single div with multiple links
I am getting to know jquery a little, and I am trying hide and show a div when a link is clicked.
I have a page setup that has a flash video in a div on the main page. Then when a link is clicked, a lightbox window opens and plays another video. I am trying to get the video on the main page to hide while the lightbox video is playing. Then when a user closes the lightbox window, the div with the main video on the page is shown and starts playing again.
So far I can get this to work with one link. But I cannot get the main video div to hide when a second link is clicked.
Not too sure if I am using the correct function/calls/code/etc...
Here is my code that is on the main page:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Link video test</title>
- <link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript"></script>
- <script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
- </head>
- <body>
- <div id="hide">
- <embed src="RT-infomercial.swf" width="340" height="250" wmode="transparent"></embed>
- </div>
- <br />
- <br />
- <strong>Links</strong><br />
- <a href="RT-infomercial.swf?width=340&height=250" rel="prettyPhoto" title="Flash 10 demo" id="hidr">Test Link 1</a><br />
- <a href="RT-infomercial.swf?width=340&height=250" rel="prettyPhoto" title="Flash 10 demo" id="hidr">Test Link 2</a>
- <br />
- <br />
- <script type="text/javascript" charset="utf-8">
- $(document).ready(function(){
- $("a[rel^='prettyPhoto']").prettyPhoto();
- });
- </script>
-
- <script type="text/javascript" charset="utf-8">
- $("#hidr").click(function () {
- $("#hide").hide();
- });
- </script>
- </body>
- </html>
Here is a link to the test page that I am attempting to get a working demo on:
FYI - Mute you speakers. The video is set to run automatically and will drive you bonkers after a while.
Any help is greatly appreciated! Thanks!