Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Durban
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 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
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    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!

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Mhtml
    var my_css_bg = new Image;
    …
    Last edited by fredmv; 02-28-2004 at 03:45 PM.

  • #4
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Durban
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    S'cuse my ignorance but that goes where exactly?
    Thanks for the reply.

  • #5
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Best place would generally be the <head> section, but I suppose it could go anywhere.

  • #6
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #7
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Durban
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

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