Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ajax image popup
Nov 02, 2006, 11:49 PM (This post was last modified: Feb 02, 2007 04:25 AM by labrocca.)
Post: #1
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.

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 File(s)
.zip  lightbox.zip (Size: 6.12 KB / Downloads: 314)

CLICK HERE to find out more about a custom theme design for mybb.
[Image: mybbsig.php]
Visit this user's website Find all posts by this user
Quote this message in a reply
Nov 02, 2006, 11:54 PM
Post: #2
RE: Ajax image popup
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()">

CLICK HERE to find out more about a custom theme design for mybb.
[Image: mybbsig.php]
Visit this user's website Find all posts by this user
Quote this message in a reply
Nov 03, 2006, 01:48 AM
Post: #3
RE: Ajax image popup
Thanx
Find all posts by this user
Quote this message in a reply
Mar 10, 2007, 05:58 AM
Post: #4
RE: Ajax image popup
thnx Smile
Find all posts by this user
Quote this message in a reply
Mar 11, 2007, 10:23 AM
Post: #5
RE: Ajax image popup
works really nice
Visit this user's website Find all posts by this user
Quote this message in a reply
Mar 13, 2007, 10:35 AM
Post: #6
RE: Ajax image popup
useful, and a funny link too
Find all posts by this user
Quote this message in a reply
Mar 13, 2007, 02:31 PM
Post: #7
RE: Ajax image popup
Great work.
Find all posts by this user
Quote this message in a reply
Mar 24, 2007, 10:32 AM (This post was last modified: Mar 24, 2007 10:45 AM by spikescot2005.)
Post: #8
RE: Ajax image popup
looking forward to this

Edit: Its not working for me. Images up just opening in a new window.
Find all posts by this user
Quote this message in a reply
Mar 24, 2007, 02:47 PM
Post: #9
RE: Ajax image popup
Check to make sure the body tag is altered.

CLICK HERE to find out more about a custom theme design for mybb.
[Image: mybbsig.php]
Visit this user's website Find all posts by this user
Quote this message in a reply
Mar 24, 2007, 03:13 PM (This post was last modified: Mar 26, 2007 03:08 PM by spikescot2005.)
Post: #10
RE: Ajax image popup
Im confused as to what to look for and do.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Image Reputation labrocca 61 5,542 Yesterday 07:31 PM
Last Post: gadeas
  Anyone interested in an Ajax Who's Online? labrocca 3 269 Jun 17, 2008 04:19 PM
Last Post: G405T
  Inline Thread Popup Problem Xtreme2damax 2 276 May 24, 2008 05:19 PM
Last Post: Xtreme2damax
  Ajax Shoutbox problem carra23 6 926 Oct 12, 2007 01:00 AM
Last Post: An_ant

Forum Jump:



MyBB Topsite icon buffet