WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: BlackBird on August 27, 2010, 01:41:00 PM

Title: Snippet: Random Hoverbox
Post by: BlackBird on August 27, 2010, 01:41:00 PM
I have packed a simple snippet to show some random images from a folder of your choice called "Random Hoverbox".

Current version1.01
Downloadhttp://www.websitebakers.com/pages/code-snippets/listings/random-hoverbox.php?lang=EN

Usage

Just add the following call to your template:

Code: [Select]
random_hoverbox();

This uses "media" as the base directory and shows 4 random images from that dir. (Only *.jpg at the moment.)

You may give a directory and a number of images to show:

Code: [Select]
random_hoverbox( '/media/folder', 5 );

To change the appearance, edit the frontend.css.

Goodie

The script uses the file name of the image file to create the content of the alt attribute. So just name your image files like the titles you wish to use.

Example:
   Filename -> My_holidays_in_Cana da.jpg
   ALT -> "My holidays in Canada"


Update:

* The valid suffixes are now configured in the include.php. Allowed suffixes: *.jpg, *.png, *.gif
* I set the z-index for the preview image to 1000 (needed this for a page using Superfish menu)