Neal Grosskopf Dot Com A NG Designs Site

Neal Grosskopf Dot Com Return To Neal Grosskopf's Home Page a NG Designs Site

Toolbar

  • Skip To
    • Menu
    • Content
  • Validate
    • HTML
    • CSS
    • WAI
  • Font Size
    • Small
    • Medium
    • Large
    • Extra Large
  • Account
    • Create Account
    • Login

Interact

Navigation

  • Home
  • Interact
    • Blog
    • Message Board
    • Open Links
    • Open Videos
    • Photo Gallery
    • Polls
    • Reviews
    • Geek Speak
  • Designs
    • View All Designs
    • Professional
    • Corporate
    • Templates
    • Personal
    • Club
    • NG Designs
    • Web Guides
  • Files
    • Artwork
    • Wallpapers
    • My File Downloads
  • Extras
    • Bookmarklets
    • The Magic 8-Ball
    • Career Builder RSS Feed Generator
    • Monster.com RSS Feed Generator

Add Tags

  Add Tags >>
 

Tag Recap

First Name:Neal
Last Name:Grosskopf
Message:

I ran into a problem on my website recently with slow loading images. The images weren't actually very large, the reason they were slow loading was because I was using ASP.NET to dynamically create thumbnails for my images off of a larger source image. I guess I'm just too lazy to resize 75+ images in photoshop and I'm very clean when it comes to throwing more files on my webserver. My solution was to have one file and just resize it with ASP.NET. That worked great but some pages had 20 or so images and could take up to 20 seconds to load them all. I started searching for solutions to this problem with JavaScript but for the most part I dislike JavaScript and I was looking for something better than "if (document.browser.support.some.random.method)". I found my salvation in CSS once again.

Apply Ajax Style Loading Image To Your Images Without JavaScript

It's really simple, in fact it's too simple I don't know why I hadn't thought of it before. Simply add the .loading class to any of your IMG elements.

.loading { background: url(loading.gif) no-repeat center center; }

But wait, that's not all

I would also recommend adding dimensions to your images via the Height and Width properties in CSS. This will ensure that your loading.gif file appears completely. My images we're dynamically added to the page via an ASP loop so this was easy enough to add.

height: 125px; width: 150px;

Alt Text?

The only drawback to this solution is in FireFox (and possibly other browsers, other than IE) the alt text will cover up the background-image. A workaround might be to give the IMG tag a title attribute instead of an ALT attribute. I know this isn't ideal but it's the best I can think of. Since my images didn't need any SEO treatment I was fine with this.

To view a demo of this view my wallpapers section of my site.

Sources:

  • Google Image Search For Loading GIF Icons
Date:2008-10-27
Time:20:58:01
Replies:4
Views:5783

Font Size:

  • A
  • A
  • A
  • A

Search:

Places:

  • Blog
  • Message Board
  • Chat Room
  • Geek Speak
  • Open Videos
  • Reviews
  • Tag Cloud
 

Site Links

Site

  • About
  • Contact Me
  • Site Map
  • Site Search

Interact

  • Blog
  • Geek Speak
  • Message Board
  • Open Links
  • Open Videos
  • Photo Gallery
  • Polls
  • Reviews

Random Stuff

  • Hosting by FatCow
  • © Copyright 2005 - 2010
  • Modified: Wednesday, September 09, 2009
  • Load Time: 0.02 Seconds

Site Coded And Designed By Neal Grosskopf Using No Crappy CMS Or Themes