1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| /* Clone some more images to make a circular animation possible */
if(my.circular)
{
/* Create temporary elements to hold the cloned images */
var first = my.Helper.createDocumentElement('div','images');
var last = my.Helper.createDocumentElement('div','images');
/* Make sure, that there are enough images to use circular mode */
max = imagesDiv.childNodes.length;
if(max < my.imageFocusMax)
{
my.imageFocusMax = max;
}
/* Do not clone anything if there is only one image */
if(max > 1)
{
/* Clone the first and last images */
var i;
for(i = 0; i < max; i++)
{
/* Number of clones on each side equals the imageFocusMax */
node = imagesDiv.childNodes[i];
if(i < my.imageFocusMax)
{
imageNode = node.cloneNode(true);
first.appendChild(imageNode);
}
if(max-i < my.imageFocusMax+1)
{
imageNode = node.cloneNode(true);
last.appendChild(imageNode);
}
}
/* Sort the image nodes in the following order: last | originals | first */
for(i = 0; i < max; i++)
{
node = imagesDiv.childNodes[i];
imageNode = node.cloneNode(true);
last.appendChild(imageNode);
}
for(i = 0; i < my.imageFocusMax; i++)
{
node = first.childNodes[i];
imageNode = node.cloneNode(true);
last.appendChild(imageNode);
}
/* Overwrite the imagesDiv with the new order */
imagesDiv = last;
}
} |
Partager