Advertisement

Need help with lightbox2 HTML code for my website.

Started by November 25, 2012 05:18 PM
-1 comments, last by TexasJack 11 years, 11 months ago
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 lightbox2 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 table 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 head tag - you can see four or so lines of script 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"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<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)&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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
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[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.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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<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>
</head>
<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">
<tr>
<td height="27" colspan="7"><img src="Layout/Title.jpg" width="428" height="27"></td>
</tr>
<tr>
<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>
</tr>
</table>
</body>
</html>

This topic is closed to new replies.

Advertisement