SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Simple javascript not running in Firefox, Safari, IE?

    Hello all,

    The site in question is: Classic Car Gallery the beginnings of a responsive web site.

    I have a simple Javascript:

    Code JavaScript:
      <script>
      	$(document).ready(function() {
            // fade in content.
            $('.coming_soon').fadeIn(5000);
        });
      </script>

    The script works well in Chrome, the image "Coming Soon" with the class '.coming_soon' fading in nicely. Unfortunately it does not work at all in Firefox, Safari, and IE! I know I must be missing something simple.

    Any help, guidance or code would be much appreciated.

    Thanks again,
    PChuprina

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Is it that the web browser doesn't perform a fade because the image is already visible?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I'm not exactly sure what you mean. I've moved the script to the head section and still not working. Why would it work in Chrome, but not Firefox? I don't think there is a error in my code, but apparently there is!

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by PChuprina View Post
    Hi,

    I'm not exactly sure what you mean. I've moved the script to the head section and still not working. Why would it work in Chrome, but not Firefox?
    Because they are made by different companies and use different rendering engines.

    Quote Originally Posted by PChuprina View Post
    I don't think there is a error in my code, but apparently there is!
    The problem occurs because you are trying to fade in something that is already fully visible.

    Hide it before you fade it in, and it will then work as you expect.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •