DarkMantis
DarkMantis

Reputation: 1516

jQuery - My Code doesn't appear to work across all browsers

I have this code:

function displayLoader( toggle ){
    if( toggle === 'show' ){
        $('.overlay, .loader').css({
            'z-index'       :   '1000',
            'display'       :   'inline'
        });
    } else {
        $('.overlay, .loader').css({
            'display':'none'
        });
    } 
}

and the CSS for this is:

.overlay{
            clear: both;
            width: 100%;
            height:100%;
            z-index:600;
            position:absolute;
            background: url('../images/overlay.jpg');
            background-repeat: repeat;
            opacity:0.65;
            filter:alpha(opacity=65); /* For IE8 and earlier */
            display:none;
}

.loader{
    z-index:1000;
    position: absolute;
    display: none;
}

And here is my relevant HTML code:

<div class="overlay">
        <div id="horizon">
            <img src="../images/ajax-loader.gif" alt="Loading... Please wait." class="loader"/><br />
            <p class="loader">Loading... Please be patient.</p>
        </div>
</div>

This works fine when I call displayLoader('show'); (or hide) if I am using FireFox but as soon as I try to use IE7+, Chrome or Safari it doesn't display anything.

My CSS is very poor as you can probably see.

Any help on this would be great.

Thanks!

Upvotes: 0

Views: 309

Answers (1)

Matthew Darnell
Matthew Darnell

Reputation: 4588

I made a fiddle. It seems to work fine for me in IE. Am I missing something?

http://jsfiddle.net/3aLgY/4/

Upvotes: 2

Related Questions