Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ajax image popup
If you want your images to open in an ajax popup here is how:

1. Download attachment.

2. Upload the files to your server:
a. Upload the images to your root/image directory.
b. Upload the lightbox.js to your root/jscripts directory.
c. Upload  lightbox.css to your root/ directory

3.  In your admincp edit the template "headerinclude".  You will add these 2 lines in your meta.

<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="jscripts/lightbox.js"></script>

4. Edit the template " postbit > postbit_attachments_thumbnails_thumbnail" you will get rid of the target="_blank" and also add rel="lightbox" to the anchor.

Finished code should be this:

<a href="attachment.php?aid={$attachment['aid']}" rel="lightbox"><img src="attachment.php?thumbnail={$attachment['aid']}" class="attachment" alt="" /></a>&nbsp;&nbsp;&nbsp;

Now the only drawback of this is when you don't allow guests to view attachments.  The ajax will popup indefinitely until clicked.  I will work on a fix for that.  For now you can go into your group and change it for  "Unregistered / Not Logged In" to allow download of attachments.

You can see working demo here:
If you installed this please post here your site.

Attached Files
.zip   Less than 1 minute ago"> (Size: 6.12 KB / Downloads: 343)
Please make sure to test this in Firefox, Opera, and IE after installation. If you are getting an error it may be an onload conflict. You may need to add to the body tag of template "Show Thread Templates > showthread" this code:

Check your body tag and look for an onload attribute. Example:
<body onload="MM_preloadImages(‘/images/menu_on.gif’)…;">
A quick fix to this problem is to append the initLightbox() to the onload attribute as so:
<body onload="MM_preloadImages(‘/images/menu_on.gif’)…;initLightbox()">
thnx Smile
works really nice
useful, and a funny link too
Great work.
looking forward to this

Edit: Its not working for me. Images up just opening in a new window.
Check to make sure the body tag is altered.
Im confused as to what to look for and do.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Image Reputation labrocca 64 59,586 Feb 11, 2009, 08:52 AM
Last Post: crazy4cs
  Ajax Shoutbox problem carra23 7 10,341 Dec 09, 2008, 01:33 AM
Last Post: PhiHDN
  Anyone interested in an Ajax Who's Online? labrocca 3 4,637 Jun 17, 2008, 04:19 PM
Last Post: G405T
  Inline Thread Popup Problem Xtreme2damax 2 4,255 May 24, 2008, 05:19 PM
Last Post: Xtreme2damax

Forum Jump:

Users browsing this thread: 1 Guest(s)