How to load fancybox automatically into the web page

This small code will attach fancybox (a lightbox clone) automatically to the images inside the web page using jQuery's methods.

This can be placed inside the HTML's head tag, AFTER the jQuery's and fancybox's source files are loaded.

This would be useful because the common user always sets images from the TinyMCE's content editor, plainly without any javascript's selector.

This code will avoid web developers or web designers to create specific PHP plugin (using preg_replace or str_replace) just to convert image's HTML codes to fancybox's mark up, which will also save the page's rendering time.

The #content word should be changed to the DOM node's id.



Comments

blog comments powered by Disqus