Script: http://www.dynamicdrive.com/dynamici...photoalbum.htm
Hello,
For some reason I can't center the images when using 2x4 grid. The images line up all in one column instead of maintaing two columns.
I have gone through the instructions given by John in a similar thread, and have added to my code everything he suggested. But the problem still remains. Here is the code:
Each of my image's width is 260px. But I have left them as "auto" both in .slideshow and .slideshow img.Code:<!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> <style type="text/css"> .slideshow{ /*CSS for DIV containing each image*/ float: center; width: auto; height: auto; } .slideshow img{ /*Change "auto" below to a number (ie: 200px) to hard code dimensions of album images*/ width: auto; height: auto; } #navlinks{ /*CSS for DIV containing the navigational links*/ width: 700px; } #navlinks a{ /*CSS for each navigational link*/ margin-right: 8px; margin-bottom: 3px; font-size: 110%; } #navlinks a.current{ /*CSS for currently selected navigational link*/ background-color: yellow; } body { background-color: #006600; } </style> </head> <body> <script type="text/javascript"> /*********************************************** * Photo Album script- © Dynamic Drive DHTML code library (www.dynamicdrive.com) * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts * This notice must stay intact for legal use ***********************************************/ var dimension="2x4" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc //Specify images: //galleryarray[x]=["path_to_image", "optional_title_attribute", "optional_text_description", "optional_link"] var galleryarray=new Array() galleryarray[0]=["0.jpg", "Click to Download", "", "optional url"] galleryarray[1]=["1.jpg", "Click to Download", "", "optional url"] galleryarray[2]=["2.jpg", "Click to Download", "", "optional url"] galleryarray[3]=["3.jpg", "Click to Download", "", "optional url"] galleryarray[4]=["4.jpg", "Click to Download", "", "optional url"] galleryarray[5]=["5.jpg", "Click to Download", "", "optional url"] galleryarray[6]=["6.jpg ", "Click to Download", "", "optional url"] galleryarray[7]=["7.jpg", "Click to Download", "", "optional url"] galleryarray[8]=["8.jpg", "Click to Download", "", "optional url"] var href_target="_new" //Enter target attribute of links, if applicable var totalslots=dimension.split("x")[0]*dimension.split("x")[1] function buildimage(i){ var tempcontainer=galleryarray[i][3]!=""? '<a href="'+galleryarray[i][3]+'" target="'+href_target+'">' : "" tempcontainer+='<img src="'+galleryarray[i][0]+'" border="0" title="'+galleryarray[i][1]+'">' tempcontainer=galleryarray[i][3]!=""? tempcontainer+'</a>' : tempcontainer tempcontainer=galleryarray[i][2]!=""? tempcontainer+'<br \/>'+galleryarray[i][2] : tempcontainer return tempcontainer } function jumptopage(p){ var startpoint=(p-1)*totalslots var y=1; for (i=0; i<totalslots; i++){ document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : "" } while(document.getElementById("navlink"+y)!=null){ document.getElementById("navlink"+y).className="" y++ } document.getElementById("navlink"+p).className="current" } var curimage=0 for (y=0; y<dimension.split("x")[1]; y++){ for (x=0; x<dimension.split("x")[0]; x++){ if (curimage<galleryarray.length) document.write('<div id="slide'+curimage+'" class="slideshow">'+buildimage(curimage)+'</div>') curimage++ } document.write('<br style="clear: left" />') } </script> <!--Below HTML code refers to the navigational links for the gallery--> <div id="navlinks"> <div style="margin:0 auto;width:700px;"> <script type="text/javascript"> for (i=1; i<Math.ceil(galleryarray.length/totalslots)+1; i++) document.write('<a id="navlink'+i+'" href="javascript:jumptopage('+i+')\">Page'+i+'</a> ') document.getElementById("navlink1").className="current" </script> </div></div> </body> </html>
However, the navlinks width have been set to 700px (wide enough), as suggested by John. The images still don't appear in two columns when centered. When they are aligned to left/right, they seem fine. But only when it's centered that the problem appears.
Any help would be appreciated. Thanks.



Reply With Quote

Bookmarks