Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery Rollover navigation breaking in ie
    primarykey
    data
    text
    <p>I am working on a jquery navigation. All's well in everything except IE. Functionality for the jquery rollover state does not work. Any thoughts? I have the wrapper navigation coded and there is a changeover effect on rollover for each link. I am thinking that I might be missing some sort of element as a work around in IE, but I am not sure. I've tried to look at other bits of code available and can't seem to find any help on what I'm missing on this one. Thank you!</p> <p>CSS:</p> <pre><code>#menu { height: 45px; width: 1000px; margin: 0 auto; position: relative } .menu ul { list-style: none; padding: 0; margin: 0; } .menu ul li { /* width and height of the menu items */ float: left; overflow: hidden; position: relative; text-align: center; line-height: 45px; } .menu ul li a { /* must be postioned relative */ position: relative; display: block; width: 190px; height: 45px; font-family: Arial; font-size: 12px; font-weight: bold; letter-spacing: 1px; text-decoration: none; cursor: pointer; } .menu ul li a span { /* all layers will be absolute positioned */ position: absolute; left: 0; width: 190px; } .menu ul li a span.out { top: 0px; } .menu ul li a span.over, .menu ul li a span.bg { /* hide */ top: -45px; } #menu { background: #000; } #menu ul li a { color: #FFF; } #menu ul li a span.over { background: #FFF; color: #fb8f2c; } </code></pre> <p>HTML:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;link rel="stylesheet" type="text/css" href="main.css" /&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrapper"&gt; &lt;!--begin wrapper--&gt; &lt;div id="header"&gt; &lt;!--begin header--&gt; &lt;div id="header-top"&gt; &lt;div id="left"&gt;&lt;img src="images/LFMD_Logo_white.png" style="border: none" /&gt; &lt;/div&gt; &lt;div id="right"&gt; &lt;p&gt; (415) 655.7546 &lt;/p&gt; &lt;/div&gt; &lt;/div&gt;&lt;!--end header top--&gt; &lt;div id="menu" class="menu"&gt; &lt;!--begin menu--&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="#"&gt;&lt;span class="out"&gt; &lt;span class="out"&gt;Link1&lt;/span&gt; &lt;span class="over"&gt;&lt;/span&gt; &lt;/span&gt;&lt;span class="bg"&gt;&lt;/span&gt;&lt;span class="over"&gt; &lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;&lt;span class="out"&gt;Link2&lt;/span&gt;&lt;span class="bg"&gt;&lt;/span&gt;&lt;span class="over"&gt;&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;&lt;span class="out"&gt;Link3&lt;/span&gt;&lt;span class="bg"&gt;&lt;/span&gt;&lt;span class="over"&gt;&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;&lt;span class="out"&gt;Link4&lt;/span&gt;&lt;span class="bg"&gt;&lt;/span&gt;&lt;span class="over"&gt;&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;&lt;span class="out"&gt;Link5&lt;/span&gt;&lt;span class="bg"&gt;&lt;/span&gt;&lt;span class="over"&gt;&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!--end menu--&gt; &lt;/div&gt;&lt;!--end header--&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>JavaScript:</p> <pre><code>$(document).ready(function() { /// wrap inner content of each anchor with first layer and append background layer $("#menu li a").wrapInner('&lt;span class="out"&gt;&lt;/span&gt;').append('&lt;span class="bg"&gt;&lt;/span&gt;'); // loop each anchor and add copy of text content $("#menu li a").each(function() { $('&lt;span class="over"&gt;' + $(this).text() + '&lt;/span&gt;').appendTo(this); }); $("#menu li a").hover(function() { // this function is fired when the mouse is moved over $(".out", this).stop().animate({ 'top' : '45px' }, 250); // move down - hide $(".over", this).stop().animate({ 'top' : '0px' }, 250); // move down - show $(".bg", this).stop().animate({ 'top' : '0px' }, 120); // move down - show }, function() { // this function is fired when the mouse is moved off $(".out", this).stop().animate({ 'top' : '0px' }, 250); // move up - show $(".over", this).stop().animate({ 'top' : '-45px' }, 250); // move up - hide $(".bg", this).stop().animate({ 'top' : '-45px' }, 120); // move up - hide }); $("#menu2 li a").wrapInner('&lt;span class="out"&gt;&lt;/span&gt;'); $("#menu2 li a").each(function() { $('&lt;span class="over"&gt;' + $(this).text() + '&lt;/span&gt;').appendTo(this); }); $("#menu2 li a").hover(function() { $(".out", this).stop().animate({ 'top' : '45px' }, 200); // move down - hide $(".over", this).stop().animate({ 'top' : '0px' }, 200); // move down - show }, function() { $(".out", this).stop().animate({ 'top' : '0px' }, 200); // move up - show $(".over", this).stop().animate({ 'top' : '-45px' }, 200); // move up - hide }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload