Test Page 1

<script> $(function() { if ($('.megamenu .current').length > 0) { var currURL = location.pathname.toLowerCase(); if($('#theme').hasClass('homepage')) { $('.megamenu').find('a.m_link[title="Home"]').parent().addClass("currentParent"); } else { $(".megamenu a.m_link[href='" + currURL + "']").parentsUntil(".megamenu", ".m_item").addClass("currentParent"); } var $el, leftPos, newWidth, $mainNav = $(".megamenu > div > ul"); $mainNav.append('<li id="magic-line"></li>'); var $magicLine = $("#magic-line"); $magicLine .width($(".megamenu > div > ul > .currentParent > a").outerWidth()) .css("left", $(".megamenu > div > ul > .currentParent > a").position().left) .data("origLeft", $magicLine.position().left) .data("origWidth", $magicLine.width()); $(".megamenu > div > ul > li > a").hover(function() { $el = $(this); leftPos = $el.position().left; newWidth = $el.parent().outerWidth(); $magicLine.stop().animate({ left: leftPos, width: newWidth }); }, function() { $magicLine.stop().animate({ left: $magicLine.data("origLeft"), width: $magicLine.data("origWidth") }); }); // Keeps bar in place when hovering over "Level1" menu $(".mega-dd").hover(function() { $el = $(this).parent(); var offsetBM = $mainNav.offset().left; var offsetLine = $el.offset().left - offsetBM; leftPos = offsetLine; newWidth = $el.outerWidth(); $magicLine.stop().animate({ left: leftPos, width: newWidth }); }, function() { $magicLine.stop().animate({ left: $magicLine.data("origLeft"), width: $magicLine.data("origWidth") }); }); } else if($('#theme').hasClass('homepage')) { $('.megamenu').find('a.m_link[title="Home"]').parent().addClass("currentParent"); var $el, leftPos, newWidth, $mainNav = $(".megamenu > div > ul"); $mainNav.append('<li id="magic-line"></li>'); var $magicLine = $("#magic-line"); $magicLine .width($(".megamenu > div > ul > .currentParent > a").outerWidth()) .css("left", $(".megamenu > div > ul > .currentParent > a").position().left) .data("origLeft", $magicLine.position().left) .data("origWidth", $magicLine.width()); $(".megamenu > div > ul > li > a").hover(function() { $el = $(this); leftPos = $el.position().left; newWidth = $el.parent().outerWidth(); $magicLine.stop().animate({ left: leftPos, width: newWidth }); }, function() { $magicLine.stop().animate({ left: $magicLine.data("origLeft"), width: $magicLine.data("origWidth") }); }); // Keeps bar in place when hovering over "Level1" menu $(".mega-dd").hover(function() { $el = $(this).parent(); var offsetBM = $mainNav.offset().left; var offsetLine = $el.offset().left - offsetBM; leftPos = offsetLine; newWidth = $el.outerWidth(); $magicLine.stop().animate({ left: leftPos, width: newWidth }); }, function() { $magicLine.stop().animate({ left: $magicLine.data("origLeft"), width: $magicLine.data("origWidth") }); }); } }); </script>