Sign in to follow this  

Need help with lightbox2 HTML code for my website.

This topic is 1878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I am currently building a website in Dreamweaver MX 2004, and because I am a print-designer, not a web-designer, I am having a lot of difficulty getting my head around some of it. Given that alot of the people on this site are scripters/coders/wizards, I thought I'd try my luck and post what I've got so far up here to see if anyone can help me out.

I am attempting to use a [url=""]lightbox2[/url] image gallery on my website, but am having difficulty coding it in to what I already have.

Basically, my website, when completed will consist of four buttons; "Graphics", "Illustration", "Photography" and "About Me/Contact".

The last button ("About Me/Contact") will simply link to another page with the relevant info on it - but the former three buttons will be connected to lightbox galleries. Clicking "Graphics" will bring up images from my graphic design portfolio in a lightbox window so that they can be flipped through. Clicking "Illustration" will display images from my illustration portfolio and so on...

If you look at the example below, you can see the clump of text within the[i] table [/i]HTML tags, those are the images that constitute the buttons, the first one "Graphics" already brings up a lightbox view of "Graphics/Workexample1.jpg" but I can only figure out how to get one image to show up within that link, instead of a collection that you can flip through. I would also like to achieve the same with the other image links ("Illustration" and "Photography").

If you look just above the closing [i]head[/i] tag - you can see four or so lines of [i]script[/i] tags that I copied and pasted directly from the lightbox website (see the link above). From my basic understanding of all of this - those bits of HTML are what make the files that come with the lightbox download (which you include in your website's root folder) do their magic.

Can anyone help with this, I'd be extremely grateful as I have been staring blankly at this for hours?

Also, my sincerest apologies if this is posted in the wrong place, I didn't want to post in any programming or coding specific forums as this is not strictly game-design related.

Many thanks,

Texas Jack.

(P.S. - The images that act as the buttons which link to my lightbox galleries are themselves roll-over images. Just to make the HTML a little more crowded for you!)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
&lt;script language="JavaScript" type="text/JavaScript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&amp;amp;&amp;amp;i<a.length&amp;amp;&amp;amp;(x=a[i])&amp;amp;&amp;amp;x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&amp;amp;&amp;amp;parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&amp;amp;&amp;amp;d.all) x=d.all[n]; for (i=0;!x&amp;amp;&amp;amp;i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&amp;amp;&amp;amp;d.layers&amp;amp;&amp;amp;i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x &amp;amp;&amp;amp; d.getElementById) x=d.getElementById(n); return x;
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
<link href="css/lightbox.css" rel="stylesheet" />
&lt;script src="js/jquery-1.7.2.min.js"></script>
&lt;script src="js/lightbox.js"></script>
<body onLoad="MM_preloadImages('Layout/Graphics_Down.jpg','Layout/Illustration_Down.jpg','Layout/Photography_Down.jpg','Layout/About_Contact_Down.jpg')">
<table width="428" height="175" border="0" align="center" cellpadding="0" cellspacing="0">
<td height="27" colspan="7"><img src="Layout/Title.jpg" width="428" height="27"></td>
<td width="73"><a href="Graphics/Workexample1.jpg" rel="lightbox"onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Graphics','','Layout/Graphics_Down.jpg',1)"><img src="Layout/Graphics.jpg" alt="Graphics" name="Graphics" width="73" height="148" border="0"></a></td>
<td width="7"><img src="Layout/Semicolon_Left.jpg" width="7" height="148"></td>
<td width="105"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Illustration','','Layout/Illustration_Down.jpg',1)"><img src="Layout/Illustration.jpg" alt="Illustration" name="Illustration" width="105" height="148" border="0"></a></td>
<td width="7"><img src="Layout/Semicolon_Middle.jpg" width="7" height="148"></td>
<td width="109"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Photography','','Layout/Photography_Down.jpg',1)"><img src="Layout/Photography.jpg" alt="Photography" name="Photography" width="109" height="148" border="0"></a></td>
<td width="6"><img src="Layout/Semicolon_Right.jpg" width="6" height="148"></td>
<td width="121"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About','','Layout/About_Contact_Down.jpg',1)"><img src="Layout/About_Contact.jpg" alt="About &amp; Contact" name="About" width="121" height="148" border="0"></a></td>
[/CODE] Edited by TexasJack

Share this post

Link to post
Share on other sites
Sign in to follow this