views:

87

answers:

4

For some reason animation methods are not working in Firefox. Even basic functions like show() do not work. They seem to work perfectly normal in IE 8. Has anyone else come across this or can explain why this is happening?

Edit: Example code -

$(document).ready(function() { 
  $(".form_error").show(); 
});

The css for .form_error sets display to none so that jQuery can then show it.

I have tried wrapping this in an IF statement and recording a console log in firebug if it works ie.

$(document).ready(function() { 
  if($(".form_error").show()) { 
    console.log('Complete') 
  } 
});

This results in a log message in Firebug. I have other jQuery methods working fine in Firefox eg css(), find() etc.

EDIT:

Here's the HTML for the table (with the error fields)

<table class="login">

        <thead>
        </thead>
        <tfoot>
            <tr><td><input type="submit" value="Sign In" /></td></tr>

            <tr><td class="auth_small_problems"><a href="forget">Forgotten details?</a></td></tr>
        </tfoot>

        <tbody>
            <tr><th scope="col"><label for="username">Username</label><br /><div class="form_error">This field is required.</div></th></tr>
            <tr><td><input type="text" id="username" name="username" value=""/></td></tr>
            <tr><th scope="col"><label for="password">Password</label><br /><div class="form_error">This field is required.</div></th></tr>

            <tr><td><input type="password" id="password" name="password" /></td></tr>
        </tbody>
        </table>

Here's the relevant CSS:

.form_error {
    -moz-box-shadow: 4px 4px 4px #3c3c3c;
    -webkit-box-shadow: 4px 4px 4px #3c3c3c;
    -opera-box-shadow: 4px 4px 4px #3c3c3c;
    box-shadow: 4px 4px 4px #3c3c3c;
    -moz-border-radius:12px 12px 12px 12px;
    -webkit-border-radius:12px 12px 12px 12px;
    -opera-border-radius:12px 12px 12px 12px;
    border-radius:12px 12px 12px 12px;
    background:none repeat scroll 0 0 #c21312;
    color:#f7f7f7;
    font-style:italic;
    font-weight:bold;
    left:300%;
    opacity: 0.8;
    padding:12px;
    position:relative;
    text-align:center;
    text-shadow:none;
    top:0px;
    width: auto;
    display: none;
}
th, td 
{
border-width:5px;
padding:10px 15px;
text-align:left;
text-shadow:1px 1px 1px #234C76;
}
#auth table.login {
margin:18px auto;
width:336px;
}

#auth table {
-moz-border-radius:10px 10px 10px 10px;
background:none repeat scroll 0 0 #69C212;
border:2px solid #234C76;
margin-top:18px;
width:960px;
}

table {
border-collapse:separate;
border-spacing:4px;
font-size:1.8em;
margin:0 auto;
padding:18px 5px 5px;
}

I hope this helps someone figure out what's going on!!

UPDATE:

It now seems to be working - occasionally! I can't pinpoint any reason why it seems to work at some times and not at others. I don't think it's anything to do with caching because I've Disabled Cache with the developer toolbar and I'm refreshing using ctl-f5.

A: 

Normally jquery works in firefox, what does firebug tell you are are there any script errors, or just missing files?

Petoj
No errors or missing files showing up in Firebug.
musoNic80
@Petoj - Please add questions as comments and save the answers as answers.
JasCav
A: 

If you're not getting any JS errors in FF or Firebug, then it's likely an issue with your HTML/CSS.

UPDATE:

You have this in your css:

left:300%;

Could that be the culprit?

DA
If it was a problem with my HTML/CSS why would it work fine in ie8?
musoNic80
@musoNic80 - Because no one browser is the same as another.
JasCav
Because IE often just does it wrong. Have you tried removing it? The only way we can narrow down your issue is for you to try the suggestions and tell us if they work or not.
DA
Thanks for the suggestion DA. I've tried commenting that line out of the CSS and it hasn't made any difference. Just out of interest, is left: 300% a weird thing or incorrect to write?
musoNic80
left: 300% would put it outside the parent container. One often sees that type of declaration to move items out of the viewport (to 'hide' them).
DA
Oh yes I realise that. The idea was to have the error message kind of out of line with the rest of the table as if someone had stuck a postit note on! Still can't work out what's happening. I've tried stripping all CSS and all js (except the command I want to work) and still no joy.
musoNic80
Hmm...maybe try setting 'overflow: visible' on the TH/TDs. I'm not even sure if you CAN position outside of a table.
DA
A: 

Have you provided duration?

$(".form_error").show('slow')
draganstankovic
Tried it with and without duration, both text and numeric versions.
musoNic80
I've tried the code you provided in firefox with a slight change: I've added 'slow' param and also put 'click me' button that starts animation (instead of starting on document.ready) and it works perfectly fine any time.
draganstankovic
A: 

Aside from stripping all other CSS that might be interfering in some way, also turn off all browser add-ons. You may be inadvertently blocking animations with some sort of ad blocker or similar. Grab the web developer extension/add on if you don't have it; it can let you enable and disable CSS easily and trace issues.

Nikki9696