Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Css and image load times

Reply
Thread Tools

Css and image load times

 
 
Gin
Guest
Posts: n/a
 
      07-09-2007
How to load first an image that I'm positioning using css ?

The image is loaded after all the images on my html template.

I'm using css for simplicity, because with it I can position this image on
the top left side of my page, without complex
html table architectures.

Thank you




 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      07-09-2007
Scripsit Gin:

> How to load first an image that I'm positioning using css ?


The loading order can be affected in JavaScript, on browsers that have
scripting enabled. For example, put the following right after the <html> tag
(so that the code will be executed as early as possible):

<script type="text/javascript">
if(document.images) {
img1 = new Image();
img1.src = "foobar.gif"; }
</script>

(It's old-style JavaScript, but should work well enough.)

> The image is loaded after all the images on my html template.


The loading order depends on many things, including their order of
appearance in the HTML source.

> I'm using css for simplicity, because with it I can position this
> image on the top left side of my page, without complex
> html table architectures.


That's fine. If you use the same image, with exactly the same URL (after
relative URLs have been resolved to absolute URLs), then browsers will most
probably cache the image so that it is practice readily available after a
user has visited one of your pages. (Unless you do something to prevent
caching; but you probably don't.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      07-09-2007
Well bust mah britches and call me cheeky, on Mon, 09 Jul 2007 13:56:08
GMT Jukka K. Korpela scribed:

> Scripsit Gin:
>
>> How to load first an image that I'm positioning using css ?

>
> The loading order can be affected in JavaScript, on browsers that have
> scripting enabled. For example, put the following right after the
> <html> tag (so that the code will be executed as early as possible):
>
> <script type="text/javascript">
> if(document.images) {
> img1 = new Image();
> img1.src = "foobar.gif"; }
> </script>


Probably should be: var img1 = new Image();

--
Neredbojias the human
 
Reply With Quote
 
Gin
Guest
Posts: n/a
 
      07-11-2007
Thank you, probably you are right, the image now is at the bottom of the
page, moving it on top can solve something

Bye

"Jukka K. Korpela" <(E-Mail Removed)> ha scritto nel messaggio
news5rki.189057$(E-Mail Removed) ti.fi...
> Scripsit Gin:
>
> > How to load first an image that I'm positioning using css ?

>
> The loading order can be affected in JavaScript, on browsers that have
> scripting enabled. For example, put the following right after the <html>

tag
> (so that the code will be executed as early as possible):
>
> <script type="text/javascript">
> if(document.images) {
> img1 = new Image();
> img1.src = "foobar.gif"; }
> </script>
>
> (It's old-style JavaScript, but should work well enough.)
>
> > The image is loaded after all the images on my html template.

>
> The loading order depends on many things, including their order of
> appearance in the HTML source.
>
> > I'm using css for simplicity, because with it I can position this
> > image on the top left side of my page, without complex
> > html table architectures.

>
> That's fine. If you use the same image, with exactly the same URL (after
> relative URLs have been resolved to absolute URLs), then browsers will

most
> probably cache the image so that it is practice readily available after a
> user has visited one of your pages. (Unless you do something to prevent
> caching; but you probably don't.)
>
> --
> Jukka K. Korpela ("Yucca")
> http://www.cs.tut.fi/~jkorpela/
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When to use std::pow(x,n) instead of times x for n times? Peng Yu C++ 17 09-14-2008 04:10 PM
Forms Authentication Fails some times and not some times??? =?Utf-8?B?bWF2cmlja18xMDE=?= ASP .Net 0 03-28-2006 10:48 PM
SetAuthCookie works some times and fails some times? =?Utf-8?B?bWF2cmlja18xMDE=?= ASP .Net 0 03-23-2006 09:24 PM
Boot Times and Recycle Times Moo Digital Photography 3 11-20-2004 12:31 PM
Why is the Constructor called 4 times but the Destructor 5 times? djskrill C++ 9 10-01-2003 07:18 PM



Advertisments