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.
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:
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:
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.