Home
Image Effects
Image Galleries
and Viewers
Here
|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
FF1+ IE6+ Opr9+
Facebox image and content viewer (v 1.1) Author:
Chris Wanstrath | FamSpam.com
Description: Facebox is a lightweight Facebook-style lightbox which can display images, divs, or entire remote pages (via Ajax) inline on the page and on demand. It uses the compact jQuery library as its engine, unlike Lightbox v2.0, which uses Prototype. Demos: FaceBox used to display an image: <p><a href="listenmusic.jpg" rel="facebox">Girl listening to music</a></p> FaceBox used to display an inline DIV:
View DIV with id="mydiv" on the page <p><a href="#mydiv"
rel="facebox">View DIV with id="mydiv" on the
page</a></p> FaceBox used to display an external page (on same server) using Ajax:
View "External.htm" fetched via Ajax <p><a href="external.htm" rel="facebox">View "External.htm" fetched via Ajax</a></p> FaceBox used to display an external page, plus apply a CSS class to the container (to further style it): View "External.htm" fetched via Ajax, , further styled via ".thickstyle" CSS class. <style type="text/css"> Directions Step 1: Insert the following code in the HEAD section of your page: Note the
valid doctype
declaration at the very top of the code, which is required unless your
page already has one defined. Facebox consists of 2
By default the zip file should be unzipped to the same directory as the page using Facebox (a sub directory facefiles/ is added). If you wish to create a dedicated directory for the above zip file, you'll want to open up facebox.js and edit the images references near the top to point to the correct locations afterwards. The references inside the code of Step 1 should also be updated accordingly. Step 2: All that's left now is to define your
Facebox "thumbnail" links on the page, by giving the link a <p><a href="listenmusic.jpg" rel="facebox">Girl listening to music</a></p> <p><a href="external.htm" rel="facebox">View "External.htm" fetched via Ajax</a></p> See the demos at the top of the page and their corresponding HTML code for more info. NotesYou can directly load some content into the Facebox container via scripting, instead of the conventional path of setting up a thumbnail link. The method to call is: jQuery.facebox('Some content to show')
You can directly close the Facebox container once it's open via scripting, instead of the default path of the user clicking on the "close" button. The method to call is: jQuery(document).trigger('close.facebox')
|