View Full Version : Resolved How to get the first image zoomed on load?

04-30-2009, 07:53 AM
Hi I am using this image zoom gallery javascript from here:

It looks like the first image zoomed is of random order. Try to refresh the page many times and you will see the random order. In the javascript code I tried to find what made the random order behavior but did not succeed.

I believe from line 320 "Diapo.prototype....." that controls the order but I couldn't find any clues about how to fix the first image, ct37.jpg, to get zoomed on load.

Please help me solve this mystery, thanks alot in advance!

P.S. You may just view the source of the above link to get all the javascript code.

04-30-2009, 10:07 AM
Oh I just solved this myself:

change this line:
if (this.parent.view < 0) this.parent.view = 0;//this.N; // 0 for setting the first image to be zoomed on load

Thanks anyway.

04-30-2009, 06:24 PM
I also figured out how to add the keyboard arrow keys navigation.

Add this lines of code

/* ==== keyboard right arrow & left arrow ==== */
this.oc.keydown = this.oc.onkeydown = function (e) {
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
if (this.parent.view < this.parent.NF - 1 && keycode == 39)
if (this.parent.view > 0 && keycode == 37)
before this line of code

/* ==== right arrow ==== */

Now you can use keyboard left and right arrow keys to navigate the images.