PDA

View Full Version : simplegallery tweak possible?



Pampaman
12-02-2011, 05:33 PM
1) Script Title: Simple Controls Gallery

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/simplegallery.js

3) Describe problem:
A friend of mine (I know how it sounds, but it´s the truth) is running almost his entire web site inside simplegallery, using it as a magazine-like control.

He didn´t like the text-on-top-only option, so he put the text inside the JPG´s, causing the site to drop off Google because there is no more plain text to index.

Also, the size is around 5 Mb, which takes forever to load here in Argentina (speed 10Kbytes/sec).
I managed to get the preload=false addition working, using the ´_iefix´ fork I found on this forum.

Now the question: is it possible to define text in standard HTML, read this text (maybe using the onslide method like in example with the ´vacation text´) and replace the (empty) text inside the calling array with this newfound text?

I got this idea from this gallary http://www.serie3.info/s3slider/demonstration.html , where they put text inside LI and SPAN blocks, so it will be found by Google.

Would it also be possible to alter the code in such a way that it also takes the top, bottom, left, right arguments as a position indicator for the text?

I would need some coding examples, because this is way over my pay grade.

Thanx in advance.

ddadmin
12-06-2011, 10:08 AM
One approach would be to define the descriptions of your gallery as a UL list on the page, initially hidden:


<ul id="descs" style="margin:0; padding:0; display:none">
<li>This is description 1</li>
<li>This is description 2</li>
<li>This is description 3</li>
<li>This is description 4</li>
</ul>

Then, using the oninit() and onslide() event handlers of the script, show the description corresponding to the current slide, for example:


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
this.$descs=jQuery('#descs').show().find('li').hide()
},
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)
this.$descs.hide().eq(i).show()
}
})