Page 1 of 1

Implementing Lightbox

Posted: Thu Jul 17, 2008 7:56 pm
by theBond
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


I want to implement lightbox through ajax.

example usage given in the site http://www.huddletogether.com/projects/lightbox/
<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>

Code: Select all

<script language="Javascript">
 
function CallAjax(url)
{
  http=CreateXHTML();
  
  
  http.open("GET", url, true);
  
  http.onreadystatechange=function(){
    if(http.readyState==4 && http.status==200)
    {
      alert(''); //Which div should i have to refer?
    }
  }
  
  http.send(null);
}
 
</script>
In the link page i am using, <a href="javascript:void(0);" onClick="CallAjax($url)">lightbox link</a>


~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: Implementing Lightbox

Posted: Fri Jul 18, 2008 4:49 am
by dhrosti
why do you need to call it using ajax?

Re: Implementing Lightbox

Posted: Fri Jul 18, 2008 10:34 am
by theBond
why do you need to call it using ajax?
1. I would like to display details of the image. If i use, <a href="images/image-1.jpg" rel="lightbox" title="my caption">link_text</a> I have to send it in title tag and if it is a text link then onmouseover the data are displayed.

2. The table structure is in such a manner it would be easy to retrieve all data of the item from many related tables of a single item.

Re: Implementing Lightbox

Posted: Fri Jul 18, 2008 7:55 pm
by RobertGonzalez
Lightbox is simple to use. Are you using the core lightbox library or are you using an library with lightbox as a plugin (like jQuery, which makes this super easy to do).

Oh yeah, this is being moved to client side.

Re: Implementing Lightbox

Posted: Sat Jul 19, 2008 7:58 pm
by theBond
Lightbox is simple to use. Are you using the core lightbox library or are you using an library with lightbox as a plugin (like jQuery, which makes this super easy to do).

Oh yeah, this is being moved to client side.
I am not using any plugin.

Re: Implementing Lightbox

Posted: Mon Jul 21, 2008 10:37 am
by RobertGonzalez
Let me ask that different. Are you using a JS library at all (jQuery, Dojo, Moo tools, Prototype)?

Re: Implementing Lightbox

Posted: Mon Jul 21, 2008 12:16 pm
by theBond
The file that i downloaded from http://www.huddletogether.com/projects/lightbox/ uses prototype.js

Re: Implementing Lightbox

Posted: Mon Jul 21, 2008 12:42 pm
by RobertGonzalez
Sorry, I know nothing about prototype. I know jQuery has a very easy to use Ajax interface to lightbox (or thickbox) which makes it really easy to use.

Re: Implementing Lightbox

Posted: Wed Jul 23, 2008 9:02 am
by theBond
Its OK, Atleast can u tell me how to disable the caption being shown on mouseover when i give textlinks?

Re: Implementing Lightbox

Posted: Wed Jul 23, 2008 10:45 am
by RobertGonzalez
If the captions are in title attributes then you are not going to be able to keep them from showing.

Re: Implementing Lightbox

Posted: Wed Jul 23, 2008 12:37 pm
by theBond
If the captions are in title attributes then you are not going to be able to keep them from showing.
Yes. what's the alternative?

Re: Implementing Lightbox

Posted: Wed Jul 23, 2008 12:56 pm
by RobertGonzalez
There is no alternative. The title attribute is a valid piece of markup and is commonly used by lightbox to render the caption when invoked.