Javascript - Thickboxize images for thickbox3.1
I tried Thickbox3.1 to make the images on this blog clickable. The images shown in article areas are limited sized thumbnails. By clicking them, the original image appears in florting window.
It's laborious to put anchar tags for all images, which is needed to be done for running Thickbox. So I automated the markup.
<script type="text/javascript"> //<![CDATA[ $(document).ready(function(){ // Setup for thickbox $('.sentences img').each(function () { var url = $(this).attr('src').replace(/¥?.+/, ''); var alt = $(this).attr('alt'); $(this).wrap( "<a href='%1' title='%2' class='thickbox'></a>" .replace('%1', url) .replace('%2', alt) ); }); }); //]]> </script> <script type="text/javascript" src="/lib/js/jquery.thickbox.js"></script> <link rel="stylesheet" href="/lib/js/thickbox/thickbox.css" type="text/css" media="screen" />
Beacuse Thickbox plugin uses $(document).ready in itself, you shoud setup anchar tag before loading thickbox.js.
Relative Entries
By Timeline
- 2009-08-08 11:35:59 縮.jp -- Generates the shortest URL in the world
- 2009-01-19 19:27:30 Javascript - jquery.clipstr.js
- 2009-01-13 06:37:27 Counter speculation of XSS
- 2009-01-09 12:51:52 Javascript - Easy Widgets to mimic iGoogle's UI
- 2009-01-05 02:37:12 List of Multi Platform Applications
- 2008-10-21 00:00:00 Javascript - Thickboxize images for thickbox3.1
- 2008-10-19 00:00:00 Javascript - newtooltip version 0.1
- 2008-08-20 00:36:11 Japanese language file for Bug Tracker
- 2008-08-06 00:19:23 Perl - Source code of this blog
- 2008-07-26 12:49:00 Perl - Image::Magick::Text::AutoBreak
Comments
no comment existsPage Navigation