Hello arsondpi!Vaska! HELLO ALL! I need YOUR HELP :-)
PROBLEM :
Automatic random slideshow : first image of the serie is the only one not to come at random! (on my homepage : www.jeanlecrenier.com)
I followed this tip (great) :
...open the slideshow.php plugin and find line:
1. timeout: 0,
change it to something like:
1. timeout: '2000',
and I linked this slideshow plugin to the slideshow JS that I customized a bit to have the pictures at random.
The slidehow goes at random, BUT the first picture to come up is always the first picture from my pictures serie of the exhibit : who can help me? I put the JS and my Plugin here below. THANKS a bunch!
JS :
fx: 'fade', // one of: fade, shuffle, zoom, slideX, slideY, scrollUp/Down/Left/Right
speed: 4000, // speed of the transition (any valid fx speed value)
speedIn: 1000, // speed of the 'in' transition
speedOut: 1000, // speed of the 'out' transition
click: null, // @deprecated; please use the 'next' option
next: null, // id of element to use as click trigger for next slide
prev: null, // id of element to use as click trigger for previous slide
pager: null, // id of element to use as pager container
before: null, // transition callback (scope set to element to be shown)
after: null, // transition callback (scope set to element that was shown)
easing: null, // easing method for both in and out transitions
easeIn: null, // easing for "in" transition
easeOut: null, // easing for "out" transition
shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 }
animIn: null, // properties that define how the slide animates in
animOut: null, // properties that define how the slide animates out
cssBefore: null, // properties that define the initial state of the slide before transitioning in
cssAfter: null, // properties that defined the state of the slide after transitioning out
fxFn: null, // function used to control the transition
height: 'auto', // container height
sync: 1, // true if in/out transitions should occur simultaneously
random: true, // true for random, false for sequence (not applicable to shuffle fx)
fit: 0, // force slides to fit container
pause: 0, // true to enable "pause on hover"
autostop: 0, // true to end slideshow after X transitions (where X == slide count)
delay: 0 // additional delay (in ms) for first transition (hint: can be negative)
};
PLUGIN :
function dynamicJS()
{
global $timeout;
return "$(document).ready(function(){
$('#s1').cycle({
fx:'fade',
speed:'4000',
speedIn:'1000',
speedOut:'1000',
next:'#next', prev:'#prev'});
});";
}
function createExhibit()
{
$OBJ =& get_instance();
global $rs;
$pages = $OBJ->db->fetchArray("SELECT *
FROM ".PX."media, ".PX."objects_prefs
WHERE media_ref_id = '$rs[id]'
AND obj_ref_type = 'exhibit'
AND obj_ref_type = media_obj_type
ORDER BY media_order ASC, media_id ASC");
// ** DON'T FORGET THE TEXT ** //
$s = $rs['content'];
if (!$pages) return $s;
$i = 1; $a = '';
// people will probably want to customize this up
foreach ($pages as $go)
{
$title = ($go['media_title'] == '') ? '' : $go['media_title'] . ' ';
$caption = ($go['media_caption'] == '') ? ' ' : $go['media_caption'];
//$x = getimagesize(BASEURL . GIMGS . '/' . $go['media_file']);
$a .= "\n
{$title}{$caption}
\n";
$i++;
}
// images
$s .= "\n";
$s .= "\n";
$s .= $a;
$s .= "\n";
$s .= "\n\n";
return $s;
}
function dynamicCSS()
{
return "#num {padding-left: 6px;}
.img-bot {margin-bottom: 6px; display: block; }";
}
?>