In the first two articles of this series, I showed you a number of steps involved in constructing a 3D HTML table and putting an image gallery in such a table. I discussed the capabilities we'd want our gallery to have, and the three modes in which it would function. In this conclusion to the series, I will show you how to get those modes working and pull everything together.
document.getElementById(ID).title="Click to Restore";
maximized = true;
}
Recall that the aim of the “maximizeFn(ID)” function is to maximize the image. If you are maximizing an image in the freezing or manual mode, the old maximizeFn(ID) function suffices. However, if you are maximizing in the automatic mode, will the planes continue to change? The planes should not continue to change. So the first thing the new “maximizeFn(ID)” function does is stop the automatic process. It does so with the statement,
clearInterval(TIDI);
using the global variable, TIDI.
The rest of the statements are as before.
The “restoreFn(ID)” function has more changes. It is now,
document.getElementById(ID).title="Click to Maximize";
maximized = false;
//continue scrolling if you are not in manual mode.
if (manualScrolling == false)
{
present--;
if (present == -1)
present = 2; //the last plane
scrollInwardCont();
}
}
All of the statements in the old functions are still there. After that you have a new section. When you click a maximized image to have it restored, if you are in the freezing or manual mode, the old statements of the “restoreFn(ID)” function suffice, since to continue working in that mode, there is no special requirement. However, if you are in the automatic mode, it would be proper if you do not go to the next plane but continue to display the present plane for an interval of time. This is because the user might not have finished glancing through all the images of the plane.
Recall that the “scrollInward()” function will always display the next plane. Also recall that the "present" variable is a global variable, which the “scrollInward()” function uses (increments) to determine the next plane. The added section in the “restoreFn(ID)” function first checks to see if you are in the automatic mode. To know if you are in the automatic mode, you simply have to know if the manualScrolling global variable is false. If it is false, you decrement the "present" global variable. This section of code calls the “scrollInward()” function through the scrollInwardCont() function. The aim of the “scrollInward()” function is to display the next plane. If the "present" variable is decremented, the function will re-display the present plane.
If the value of the "present" variable is zero and you decrement it, you will have –1. There is no plane having the index of –1. In this case you have to set the variable preset to 2, which is the index in the reverse order.
The explanation of the added section in the “restoreFn(ID)” function should now be clear.