.mouseover/.hover help!
.mouseover/.hover help!
OK So I got 5 images, 3 are headers and layered using z-index(head, head-templates, head-projects) to be on-top of each other; the other 2 are just images for the mouseover(templates, projects). What I want to happen is when you hover over the image templates I want it to animate head to head-templates and when you put your mouse over projects it animates head to head-projects. When your mouse take your mouse off, so mouseout is used, I want it to animate back to head. The code for my website is as follows:
- <!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>
- <link rel="stylesheet" href="style.css" media="screen" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>PRENTICE.tk</title>
- <script type="text/javascript" src="jquery.min.js"></script>
- <script type="text/javascript">
- $(function() {
- $('img.head-templates,img.head-projects').hide();
- $('img.templates').hover(function() {
- fadeBetween('img.head', 'img.head-templates');
- },function() {
- fadeBetween('img.head-templates', 'img.head');
- });
- $('img.projects').hover(function() {
- fadeBetween('img.head', 'img.head-projects');
- },function() {
- fadeBetween('img.head-projects', 'img.head');
- });
- });
- function fadeBetween(from, to) {
- $(from).stop(true, true).fadeOut();
- $(to).stop(true, true).fadeIn();
- }
- </script>
- <script type="text/javascript" src="rollover.js"></script>
- </head>
- <body onload="MM_preloadImages('images/navbar/home-hover.png','images/navbar/templates-hover.png','images/navbar/projects-hover.png','images/navbar/blog-hover.png','images/navbar/contact-hover.png')">
- <div id="header">
- <img src="images/header.png" class="head" alt="HEADER" height="200px" />
- <img src="images/header-templates.png" class="head-templates" alt="HEADER" height="200px" />
- <img src="images/header-projects.png" class="head-projects" alt="HEADER" height="200px" />
- </div>
- <div id="navbar">
- <a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/navbar/home-hover.png',1)"><img src="images/navbar/home.png" name="Home" width="100" height="50" border="0" id="Home" class="first"/></a>
- <a href="templates.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Templates','','images/navbar/templates-hover.png',2,'Head','','images/head-templates.png')"><img src="images/navbar/templates.png" alt="Templates" name="Templates" width="120" height="50" border="0" id="Templates" class="templates"/></a>
- <a href="projects.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Projects','','images/navbar/projects-hover.png',1)"><img src="images/navbar/projects.png" alt="Projects" name="Projects" width="110" height="50" border="0" id="Projects" class="projects"/></a>
- <a href="http://blog.prentice.tk" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Blog','','images/navbar/blog-hover.png',1)"><img src="images/navbar/blog.png" alt="Blog" name="Blog" width="90" height="50" border="0" id="Blog" /></a>
- <a href="contact.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Contact','','images/navbar/contact-hover.png',1)"><img src="images/navbar/contact.png" alt="Contact" name="Contact" width="110" height="50" border="0" id="Contact" /></a>
- </div>
- </body>
- </html>
And the css
- @charset "utf-8";
- /* CSS Document */
- body {
- background:url(images/bg.png) repeat;
- width: 1000px;
- margin-left:auto;
- margin-right:auto;
- text-align:center;
- }
- #navbar {
- width:1000px;
- border:1px #000 solid;
- background-image:url(images/navbar/bg.png);
- height:50px;
- text-align:left;
- }
- #navbar img{
- border-right:1px #000 solid;
- border-left:1px #3C3C3C solid;
- margin-right:-4px;
- }
- .first {
- border-left:none;
- }
- #header{
- position: relative;
- height:200px;
- }
- #bookmark img{
- padding:5px;
- }
- .head{
- position: absolute;
- left: 0;
- top: 0;
- z-index: 10;
- }
- .head-templates{
- position: absolute;
- left: 0;
- top: 0;
- z-index:9;
- }
- .head-projects{
- position: absolute;
- left: 0;
- top: 0;
- z-index:8;
- }
Please help I dunno what to do?