Snippet: Random Hoverbox

BlackBird

#1
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:


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:


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_Canada.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)
[url=http://wbaddons.webbird.de]http://wbaddons.webbird.de[/url] [url=http://www.WebsiteBaker.org/forum/index.php/topic,27476.msg189845.html#msg189845]Don't miss this[/url]