Combine non animated pics into 1 gif and use CSS Sprites to select images.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

FileSize
5.8 KB

Better yet, using http://spritegen.website-performance.org/ here's the output

mikeytown2’s picture

Status: Active » Needs review
FileSize
4.79 KB

Sat down and did it for lightbox-alt. Here is a zip of my files. Also I changed the Close Icon to red. I don't use the slideshow option, but that could be loaded into the sprite.

stella’s picture

Status: Needs review » Needs work

Marking back to needs work - changing the close button to red is not something I'm willing to consider at this time. The rest looks good, but haven't fully tested it yet.

mikeytown2’s picture

Status: Needs work » Needs review
FileSize
6.23 KB

Switched close back to original and added in Play/Pause.

extect’s picture

Title: CSS Sprites - 1 gif » CSS Sprites -> PNG
FileSize
1.55 KB
2.18 KB
5.86 KB
4.8 KB

Changed sprites to PNG8 to reduce file size.

I also attached new versions of loading.gif and loading_lite.gif, which have been improved using gifsicle (lossless improvement).

loading.gif: 2767 Bytes -> 1588 Bytes
loading_lite.gif: 2364 Bytes -> 2228 Bytes

mikeytown2’s picture

@extect
Only problem with PNG's is IE6, thus I think the reduction in file sizes isn't worth the it. Also Include the css changes to the lightbox css files, that way you can test it. Simply providing the output from http://spritegen.website-performance.org/ is not the way to do it. Splitting up the sprites into lightbox.css, lightbox_lite.css & lightbox_alt.css (already done) is the way to go. That way it only loads what you will use.

extect’s picture

No, IE6 has no problems with PNG as long as you don't use alhpa transparency. As all the images for lightbox2 don't use that, my files should be totally fine for IE6.

daemon’s picture

extect is right, png has no problems as long as you do not use alpha transparency.

It is not about file size reduction these days but the number of connections (http requests) the client makes to the server.
See Yahoo's Best Practices for Speeding Up Your Web Site.

jcisio’s picture

Title: CSS Sprites -> PNG » Optimization: use CSS sprite and PNG
Status: Needs review » Reviewed & tested by the community

Just put the two alt files into my Lightbox2 module folder. It works well.

Jak-o’s picture

Hi how to implement this trick?

Thanks

joergvk’s picture

jak-o,

unzip the files in your lightbox2 module folder /ccs and /images and make sure you don't use the folder names in the zip. Then change the settings of lightbox 2 to use the alternative user interface if you don't use that interface already. That's it.

Joerg

Bensbury’s picture

That's very nice.
Thanks for doing this.

Jak-o’s picture

Joerg thank you!

jak-o

lyricnz’s picture

Can the maintainer of this module review this option? Lightbox2 and my Fusion-derived theme are the two main culprits for my 50+ images on a page.

xl_cheese’s picture

Thanks for the image and css file!

I don't know if it's related, but after installing this I no longer get the background to darken when opening a lightbox image or frame.

baronmunchowsen’s picture

In the lightbox_alt.css file, the selector #overlay should be #lightbox2-overlay - this will give you the dark background again.

ressa’s picture

Great work mikeytown2, I got rid of 8 elements by dropping in the two files and choosing "Use alternative layout" and went from 77 points to 82 on http://webpagetest.org :-)
It's RTBC.

pifagor’s picture

Issue summary: View changes

+1