PDA

View Full Version : Simple Controls Gallery v1.3 help with starting pic



miob
03-03-2009, 04:21 PM
1) Simple Controls Gallery v1.3
2) http://www.dynamicdrive.com/dynamicindex4/simplegallery.htm
3) My problem:
i want to start showing slideshow not from 1st picture, but e.g. from 3rd pic, need to have loaded on the start not first pic as is on default

i'm sure it ensures this function, but didn't find any information how to use it

onslide:function(curslide, i){ //event that fires after each slide is shown
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}

jscheuer1
03-03-2009, 05:04 PM
var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
imagearray: [
["http://i26.tinypic.com/11l7ls0.jpg", "http://en.wikipedia.org/wiki/Swimming_pool", "_new", "There's nothing like a nice swim in the Summer."],
["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", "", ""],
["http://i30.tinypic.com/531q3n.jpg", "", "", "Eat your fruits, it's good for you!"],
["http://i31.tinypic.com/119w28m.jpg", "", "", ""]
],
autoplay: [true, 2500, 2], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
this.showslide(2);
},
onslide:function(curslide, i){ //event that fires after each slide is shown
//Keyword "this": references current gallery instance
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}
})

miob
03-03-2009, 09:33 PM
yeah works as i wanted


i just one more thing , i can see like first pic is loading then it's switched to defined nr of pic. is there any way how to stop loading that first one, it doesn't look very well

jscheuer1
03-04-2009, 04:04 AM
You could just change the order of the slides so that the one you want comes first. Or you could just wrap your gallery in a division, ex:


<div id="mywrapper1" style="visibility:hidden;">
<div id="simplegallery1"></div>
</div>

Then in the oninit:


oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
this.showslide(2);
document.getElementById('mywrapper1').style.visibility = visible;
},

miob
03-04-2009, 08:39 PM
i have it here:

http://www.autobazar.eu/sk/facal.html

it works ok when you click on 3rd, 5th, 7th... but when i click on almost last one, i can see 1st pic loaded and shown that requested one immediately after it,
is there any way yet how to fix it?

jscheuer1
03-04-2009, 08:47 PM
I don't see the Simple Controls Gallery v1.3 on that page.

miob
03-04-2009, 08:49 PM
lol, pres any pic , i showed that url because it really depends what pic you start with...

jscheuer1
03-04-2009, 11:25 PM
You should have explained that. I will look into it later. Have you tried my suggestion to use a wrapping division?

miob
03-05-2009, 12:33 AM
sure i pasted your code
mywrapper1 is hidden...

you can see it on the last pics like it's refreshing from 1st loaded picture...

http://www.autobazar.eu/sk/pics2.php?id=892760&pic=14
http://www.autobazar.eu/sk/pics2.php?id=892760&pic=15

jscheuer1
03-05-2009, 04:37 AM
Well of course, it's doing exactly that in all cases. It's just that if the image is ready it happens too fast for you to notice. The script preloads all of the images in order, so the last one(s) will take the longest to get ready.

Now I'm assuming that you are using PHP to write out the page with the number of the desired image in our custom oninit function. Something like (my PHP isn't the best):


this.showslide(<?php echo ($_GET(pic) - 1); ?>)

Whatever you are doing, we can move things around and change them a little and hopefully get it to wait until it has slid to reveal the image. But it will depend upon what the script means by onslide. If it mens what I think it does, it might work out:


oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
this.showslide(13);
},
onslide:function(curslide, i){ //event that fires after each slide is shown
//Keyword "this": references current gallery instance
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
if(i == 13)
document.getElementById('mywrapper1').style.visibility = visible;
}

So however you are getting the number, have it appear in the two places as shown in the above (13 highlighted red). Give that a shot and see what happens.

It would probably also help if the larger images weren't as large. Try optimizing them for a lower byte count, and consider reducing their dimensions some as well.

Nile
03-05-2009, 04:41 AM
@John:


this.showslide(<?php echo ($_GET(pic) - 1); ?>)

Should be:


this.showslide(<?php echo ($_GET['pic'] - 1); ?>)


;)

jscheuer1
03-05-2009, 04:47 AM
Well of course, it's doing exactly that in all cases. It's just that if the image is ready it happens too fast for you to notice. The script preloads all of the images in order, so the last one(s) will take the longest to get ready.

Now I'm assuming that you are using PHP to write out the page with the number of the desired image in our custom oninit function. Something like (my PHP isn't the best):


this.showslide(<?php echo ($_GET(pic) - 1); ?>)

Whatever you are doing, we can move things around and change them a little and hopefully get it to wait until it has slid to reveal the image. But it will depend upon what the script means by onslide. If it mens what I think it does, it might work out:


oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
this.showslide(13);
},
onslide:function(curslide, i){ //event that fires after each slide is shown
//Keyword "this": references current gallery instance
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
if(i == 13)
document.getElementById('mywrapper1').style.visibility = visible;
}

So however you are getting the number, have it appear in the two places as shown in the above (13 highlighted red). Give that a shot and see what happens.

It would probably also help if the larger images weren't as large. Try optimizing them for a lower byte count, and consider reducing their dimensions some as well.


@John:


this.showslide(<?php echo ($_GET(pic) - 1); ?>)

Should be:


this.showslide(<?php echo ($_GET['pic'] - 1); ?>)


;)

I'm surprised I was that close. I figure they already had that part right, or were doing it some other way.

miob
03-05-2009, 10:45 PM
I'm surprised I was that close. I figure they already had that part right, or were doing it some other way.

i have there exactly same thing :)

miob
03-05-2009, 11:00 PM
i get error when i put this

if(i == 13)
document.getElementById('mywrapper1').style.visibility = visible;



when i press 13th pic i get error: simple controls gallery: an error occured somewhere in your code attached to the "onlslide" event: [Object error]

did yo mean write it on flat 13, or use that php code echo ($_GET['pic'] - 1); , let's making only from that img

it's still not ok, is there not any chance to wait till all loads, it really looks bad when i can see 1st pic, we can't reduce, we have max 1024x768 , but nr of pics vary from 1 to 40, 50, each offer has unlimited nr of pics... i need to solve this somehow...

miob
03-10-2009, 11:14 PM
nobody is gonna find solution ?

miob
03-16-2009, 08:52 PM
my friend helped me, maybe someone will appreciate that i posted that error in code...


i replaced in simplegallery.js

instead of this

setting.curimage=(setting.persist)? simpleGallery.routines.getCookie("gallery-"+setting.wrapperid) :


setting.curimage=(setting.persist)? simpleGallery.routines.getCookie("gallery-"+setting.wrapperid) : setting.curimage






before oninit function i have added:

curimage: <?echo $_GET['pic'];?>,


and all works perfectly as i wanted here