views:

70

answers:

1

I'm using the following function, called from document.ready(), to set a fadeIn/fadeOut effect on the top navigation of this page: http://bit.ly/dzVXB1

// Initialize the main menu's rollover behavior.
function initNavMenu(fadeInTime,fadeOutTime){
    $('#top-nav li').append('<div class="hover"></div>');

    $('#top-nav li').hover(
        function(){
            $(this).children('div').fadeIn(fadeInTime);
        },

        function(){
            $(this).children('div').fadeOut(fadeOutTime);
        }).click (function() {
            $('#top-nav li.selected').removeClass('selected');
            $(this).addClass('selected');
    });
}

It works well enough on FF 3.6.9, Chrome, Safari, and Opera. But on IE 8 (and probably lower versions), I get an ugly, smeared ink effect when I roll over the button. The smeared effect goes away once the fade is done. Anyone know what's causing this?

+1  A: 

Just see by Developer toolbar in IE after the control is visible due to fade effect it is adding some code for opacity. Just remove the piece of code by writing

$('selector').css('attribute', '');
or write 
$('selector').removeAttr('style'); // Removes all inline styles.

Hope this will help you :)

Dev
Thanks, Dev. Where in Developer Toolbar did you see this?
Alex
Just search for the particular item, search in IE toolbar and in the style tab you can find all its associated properties.
Dev
Thanks, Dev. Where would I add your code in the initNavMenu() function above?
Alex
In IE it adds 'filter' to change the opacity of the element. So after fadeIn effect it keeps the filter css attribute as it is so after the line $(this).children('div').fadeIn(fadeInTime) you can write code to remove it.
Dev