![]() | |
| The image on the top is the same image at the center of the gallery, it auto resizes and center when clicked. |
added an additional 61 lines of codes to project and here they are.
function editContent(itemIndex){
var iIndex = itemIndex;
var currentPageIndex = checkWhichButtonOn("");
var imgPath = searchArray[currentPageIndex][itemIndex][1];
var editImgBox = new Image();
editImgBox.src = imgPath;
if (editImgBox.complete) {
var imgOrientation = checkImgOrientation(editImgBox);
var imgNewDimension = imgScaler(imgOrientation, editImgBox.height, editImgBox.width);
var editImgBoxConfiguration = new Array(4);
editImgBoxConfiguration = configureEditImgBox(imgNewDimension,imgOrientation);
displayEditBox(editImgBoxConfiguration[0], editImgBoxConfiguration[1], editImgBoxConfiguration[2], editImgBoxConfiguration[3], editImgBox.src);
}
else{
editContentTimer = setTimeout("editContent(\'"+iIndex+"\')",1200);
imgBoxPathTransferTimer = true;
}
}
function imgScaler(imgOrientation, imgHeight, imgWidth){
if (imgBoxPathTransferTimer) {
setTimeout(editContentTimer);
}
if (imgOrientation == "orientationPortrait"){
var computeScaledDimension = Math.ceil((192*imgHeight)/imgWidth);
}
if (imgOrientation == "orientationLandscape"){
var computeScaledDimension = Math.ceil((192*imgWidth)/imgHeight);
}
return computeScaledDimension;
}
function configureEditImgBox(imgNewDimension,imgOrientation){
var editImgBoxConfiguration = new Array(4);
if (imgOrientation=="orientationPortrait"){
var imgWidth = "192";
var imgHeight = imgNewDimension;
var imgLeft = 0;
var imgTop = -1*((imgHeight/2)-96);
}else{
var imgWidth = imgNewDimension;
var imgHeight = "192";
var imgLeft = -1*((imgWidth/2)-96);
var imgTop = 0;
}
editImgBoxConfiguration = [imgWidth,imgHeight,imgLeft,imgTop]
return editImgBoxConfiguration;
}
function displayEditBox(imgWidth,imgHeight,imgLeft,imgTop,src){
var editImgBox = document.getElementById('imgBox');
editImgBox.style.width = imgWidth+"px";
editImgBox.style.height = imgHeight+"px";
editImgBox.style.left = imgLeft+"px";
editImgBox.style.top = imgTop+"px";
editImgBox.src = src;
}
Ill be doing the pure edit-area functions, 1st would be the information display function and then the content-edit functions.

Walang komento:
Mag-post ng isang Komento