Home arrow HTML arrow Page 4 - Building an Image Gallery in a 3D HTML Table
HTML

Building an Image Gallery in a 3D HTML Table


This article aims to show you how you can use an HTML three-dimensional table as a picture gallery. The HTML specification does not specify a 3D HTML table. However, you can create one, as I've discussed in a previous article. You will also need basic knowledge of database tables, HTML, DOM and JavaScript. This article is the first part of a three-part series.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
February 02, 2009
TABLE OF CONTENTS:
  1. · Building an Image Gallery in a 3D HTML Table
  2. · 3D HTML Table: a Closer Look
  3. · The Table Code
  4. · Viewing the Next Plane

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building an Image Gallery in a 3D HTML Table - Viewing the Next Plane
(Page 4 of 4 )

There is a button with the title of “Next Set” at the bottom of the table. “Next Set” means click to see the next set of minimized images in the next plane. The code for the button is:


<button type="button" onclick="scrollInward()">Next Set</button>


The “ScrollInward()” function is called each time you click the “Next Set” Button.


The scrollInward() Function

This function has a global variable called "present." This is an integer. Its initial value is zero. This variable shows the index of the plane that is currently displayed. I call the plane displayed the Present Plane.

When the function is called, it goes into a for-loop to scan the rows of the present plane. Inside this for-loop is another loop to scan the columns of the present plane.

Inside this second for-loop, the ID of the single-row table is formed using the row index and the column index of the present plane. The value of the display property of the cell of the single-row table in the present plane is changed to “none.” One is added to the "present" variable, and the result is assigned to an inner variable, k. This inner variable is used to give the value “block” to the next cell of the single-row table. This is the “scrollInward()” function with its global variable:


var present = 0; //for changing vertical planes


function scrollInward()

{

for (i=0; i<3; i++)

{

for (j=0; j<3; j++)

{

//form the inner table IDs

TID = 'T' + i +j


document.getElementById(TID).rows[0].cells[present].style.display = "none";

var k = present + 1;

if (k==3)

k = 0;

document.getElementById(TID).rows[0].cells[k].style.display = "block";

}

}


present+=1;

if (present == 3)

present = 0;

}


After the for-loops, the "present" variable is incremented, so that the next time the function is called (with a button click) the next plane will be addressed. In our example there are only three planes. Our last plane is plane 2, not plane 3, since the counting of the planes begins from zero. So after incrementing the "present" variable, we check to see if it becomes 3. If it becomes 3, we reset it to 0, the first index.

Let us have a break here. In the next part, we will start by learning how to maximize and restore the images in the 3D table.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials