Web Analytics Made Easy -
StatCounter Preload background img attached with CSS? - CodingForum

Announcement

Collapse
No announcement yet.

Preload background img attached with CSS?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Preload background img attached with CSS?

    Is it possible to preload a background image that is attached using CSS?
    Dreamweaver doesn't give you the option to preload the image as it doesn't see it as being IN the page.

  • #2
    You can always make your own preloader! CSS doesn't have the ability to do this.

    Code:
    var my_css_bg = new image;
    my_css_bg.src = 'css_bg.gif';
    That's all it requries ( I think ), I'm not a JS guru though .. if it's wrong I'm sure someone else will correct me.
    Omnis mico antequam dominus Spookster!

    Comment


    • #3
      Originally posted by Mhtml
      var my_css_bg = new Image;
      …
      Last edited by fredmv; Feb 28, 2004, 10:45 AM.
      Moderator @ WebDeveloper.com
      Mentor @ WebXpertz.net

      Comment


      • #4
        S'cuse my ignorance but that goes where exactly?
        Thanks for the reply.

        Comment


        • #5
          Best place would generally be the <head> section, but I suppose it could go anywhere.
          Moderator @ WebDeveloper.com
          Mentor @ WebXpertz.net

          Comment


          • #6
            Inside <script type="text/javascript"> and </script>. (Note that application/x-javascript is technically more correct as 1) javascript isn't text and 2) I don't think text/javascript is a technically registered mime type but application/x-javascript is poorly supported).
            David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
            W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

            Comment


            • #7
              Thanks for the help.

              I have found that what I was using did work (helluva complicated) on IE and Netscape FOR PC. But of course it doesn't behave like it should on IE5 for Mac which is what I'm working on .

              Why oh why can't they just make all browsers and OS's compatable? Oh I know... 'cos then I might not sit here till 2.30am on a Saturday night fighting with it!

              Comment

              Working...
              X