[jQuery] My first attempt at showing/hiding div with jQuery
Hi,
In my first attempt at showing and hiding a div with jQuery, I've
hacked together this code and I'm looking for any thoughts on what I
did wrong (if anything?) The code seems to work in FireFox, IE7, and
Safari/Chrome. Opera and IE6 seem to work at random, so I'm not
exactly sure what's up with them, but I assume my code is flawed?
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="shortcut icon" href="/favicon.ico" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#rssInfo").hide();
$("a#subscribeRollover").click(function () {
$("#rssInfo").show("fast");
});
$("a#rssInfoClose").click(function () {
$("#rssInfo").hide("fast");
});
});
</script>
<style type="text/css">
/*
-- -- -- -- -- -- --
undohtml.css
Undo browser defaults
http://tantek.com/log/2004/09.html#d06t2354
-- -- -- -- -- -- --
*/
/* -- undo browser HTML defaults -- */
:link,:visited {text-decoration: none;}
ul,ol {list-style: none;}
h1,h2,h3,h4,h5,h6,pre,code,p {font-size: 1em;}
ul,ol,dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input
{margin: 0; padding: 0;}
a img,:link img,:visited img {border: none;}
address {font-style: normal;}
*:focus {outline: none;}
ul#nav {
float: left;
}
ul#nav li {
float: left;
padding: 0 10px;
}
#rssInfo {
background: #ccc;
color: #444;
float: left;
clear: both;
width: 400px;
padding: 10px;
}
</style>
</head>
<body>
<ul id="nav">
<li><a href="#" id="galleryRollover" title="Gallery">Gallery</a></
li>
<li><a href="#" id="blogRollover" title="Blog">Blog</a></li>
<li><a href="#" id="submitRollover" title="Submit">Submit</a></li>
<li><a href="#" id="subscribeRollover" title="Subscribe">Subscribe</
a></li>
</ul>
<div id="rssInfo">
<a href="#" id="rssInfoClose"><img src="images/close.gif"
alt="Close" /></a>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus
et magnis dis parturient montes, nascetur ridiculus mus.
</div>
</body>
</html>