- IE8 not working correctly with .hover() and .animate() in jQuery. Chrome and FF are ok, typical
- <div id="nav_bar">
- <img id="nav_block" src="images/main/nav_block.png" alt="" />
- <a id="nav_home" class="nav_link" href="home.php">
- <span id="nav_holder_home" class="nav_holder">Home</span>
- </a>
- <a id="nav_about" class="nav_link" href="home.php">
- <span id="nav_holder_about" class="nav_holder">About</span>
- </a>
- <a id="nav_services" class="nav_link" href="home.php">
- <span id="nav_holder_services" class="nav_holder">Services</span>
- </a>
- <a id="nav_gallery" class="nav_link" href="home.php">
- <span id="nav_holder_gallery" class="nav_holder">Gallery</span>
- </a>
- <a id="nav_contact" class="nav_link" href="home.php">
- <span id="nav_holder_contact" class="nav_holder">Contact</span>
- </a>
- </div>
- $(document).ready(function(){
- var current_pos = 0;
- var hover_pos = 0;
- $('.nav_holder').hover(function() {
- $("#nav_block").stop(true, false);
- if ($(this).attr("id") == "nav_holder_home") {
- hover_pos = 0;
- } else if ($(this).attr("id") == "nav_holder_about") {
- hover_pos = 1;
- } else if ($(this).attr("id") == "nav_holder_services") {
- hover_pos = 2;
- } else if ($(this).attr("id") == "nav_holder_gallery") {
- hover_pos = 3;
- } else if ($(this).attr("id") == "nav_holder_contact") {
- hover_pos = 4;
- }
- $("#nav_block").animate({
- marginLeft: (hover_pos*98)
- }, 200 );
- }, function () {
- $("#nav_block").animate({
- marginLeft: (current_pos*98)
- }, 200 );
- });
- $('.nav_holder').click(function() {
- if ($(this).attr("id") == "nav_holder_home") {
- current_pos = 0;
- } else if ($(this).attr("id") == "nav_holder_about") {
- current_pos = 1;
- } else if ($(this).attr("id") == "nav_holder_services") {
- current_pos = 2;
- } else if ($(this).attr("id") == "nav_holder_gallery") {
- current_pos = 3;
- } else if ($(this).attr("id") == "nav_holder_contact") {
- current_pos = 4;
- }
- });
- });
- a.nav_link {
- font: 18px/100px Tahoma, Arial, sans-serif;
- z-index: 10;
- }
- #nav_bar {
- position: absolute;
- top: 0px;
- left: 490px;
- width: 490px;
- height:110px;
- background-color:#f0f0f0;
- overflow: visible;
- }
- #nav_block {
- position: absolute;
- top: 0px;
- left: 4px;
- width: 90px;
- height:110px;
- z-index: 9;
- }
- .nav_holder {
- width: 98px;
- height:100px;
- text-align: center;
- overflow: visible;
- z-index: 11;
- }