Connecting Tech Pros Worldwide Help | Site Map

Add lightbox to query string?

  #1  
Old June 23rd, 2009, 09:50 PM
Newbie
 
Join Date: Apr 2009
Posts: 26
I recently found a gallery (http://www.planet-source-code.com/vb...=6727&lngWId=4). The image in the gallery when clicked on will open the larger image in the same window. I want to replace it with light box. I have added the lightbox javascript, but I'm no sure where to place the light box call.

To call the lightbox, i have to add this:
Expand|Select|Wrap|Line Numbers
  1. <a href="stairs.jpg" rel="lightbox">text</a>
Even though this is a text example of course.


here is the code for the page:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. If IsArray(varImageAry) Then
  3.     lngMaxIndex = UBound(varImageAry, 2)
  4.     Response.Write("<TABLE>")
  5.     For lngIndex = 0 To lngMaxIndex
  6.         lngImageID = varImageAry(0, lngIndex)
  7.         strTitle = varImageAry(1, lngIndex)
  8.         strDescription = varImageAry(2, lngIndex)
  9.  
  10.         If Not Len(strTitle) = 0 Then strTitle = Server.HTMLEncode(strTitle)
  11.         If Not Len(strDescription) = 0 Then strDescription = Server.HTMLEncode(strDescription)
  12.         Response.Write("<TR>")
  13.         Response.Write("<TD valign=""top"">")
  14.         Response.Write("<IMG src=""image.asp?ImageID=" & lngImageID & """ width=""100"" border=""1"">")
  15.         Response.Write("</TD>")
  16.         Response.Write("<TD valign=""top"">")
  17.         Response.Write("<A href=""image.asp?ImageID=" & lngImageID & """><B>" & strTitle & "</B></A><BR>")
  18.         Response.Write(strDescription)
  19.         Response.Write("</TD>")
  20.         Response.Write("</TR>")
  21.  
  22.     Next
  23.  
  24.     Response.Write("</TABLE>")
  25. Else
  26.     Response.Write("No images are present in this category.")
  27. End If
  28. %>
Anyone have any suggestions where to add my rel="lightbox" to the query?
  #2  
Old June 25th, 2009, 08:46 PM
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North :)
Posts: 4,940
Provided Answers: 8

re: Add lightbox to query string?


I've never used LightBox before but it looks amazing!
I'm going to look into using it when I update one of my web applications.
:)

Here's a link to the Official Lightbox website.

According to that website you add the "rel" attribute to the hyperlink that opens the image.

I might be wrong here but, in your example I think you'd add it as follows:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. If IsArray(varImageAry) Then
  3.     lngMaxIndex = UBound(varImageAry, 2)
  4.     Response.Write("<TABLE>")
  5.     For lngIndex = 0 To lngMaxIndex
  6.         lngImageID = varImageAry(0, lngIndex)
  7.         strTitle = varImageAry(1, lngIndex)
  8.         strDescription = varImageAry(2, lngIndex)
  9.  
  10.         If Not Len(strTitle) = 0 Then strTitle = Server.HTMLEncode(strTitle)
  11.         If Not Len(strDescription) = 0 Then strDescription = Server.HTMLEncode(strDescription)
  12.         Response.Write("<TR>")
  13.         Response.Write("<TD valign=""top"">")
  14.         Response.Write("<IMG src=""image.asp?ImageID=" & lngImageID & """ width=""100"" border=""1"">")
  15.         Response.Write("</TD>")
  16.         Response.Write("<TD valign=""top"">")
  17.  
  18.  
  19.         Response.Write("<A href=""image.asp?ImageID=" & lngImageID & """   rel= """ & "lightbox[groupName]""" & "><B>" & strTitle & "</B></A><BR>")
  20.  
  21.  
  22.         Response.Write(strDescription)
  23.         Response.Write("</TD>")
  24.         Response.Write("</TR>")
  25.  
  26.     Next
  27.  
  28.     Response.Write("</TABLE>")
  29. Else
  30.     Response.Write("No images are present in this category.")
  31. End If
  32. %>

-Frinny
  #3  
Old June 25th, 2009, 11:40 PM
Newbie
 
Join Date: Apr 2009
Posts: 26

re: Add lightbox to query string?


Great, thanks for the response! I'll give it a shot and see how it works.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with location.href, query URL and IE(Mac) & Safari Mark Anderson answers 4 July 20th, 2005 02:14 PM