REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ajax image popup
#1
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.

Code:
<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:

Code:
<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:  

http://www.democracyforums.com/showthread.php?tid=2006
If you installed this please post here your site.


Attached Files
.zip   Less than 1 minute ago">lightbox.zip (Size: 6.12 KB / Downloads: 343)
#2
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()">
#3
Thanx
#4
thnx Smile
#5
works really nice
#6
useful, and a funny link too
#7
Great work.
#8
looking forward to this

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


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

Forum Jump:


Users browsing this thread: 1 Guest(s)