ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > RocketCake
forum topic indicator Slideshow Random Order Recap
person icon
ivarforkbeard
Registered User
Quote
2025-01-13 11:40:46

Can we go over how to make the slideshow work in a random order again? I checked the previous thread but I think you've changed the JavaScript code enough from when you wrote the how-to so that it doesn't seem to look right, and when I try to modify, it still doesn't work.

With my modifications, the show doesn't work at all. It shows the pips down below to navigate, and just alternates highlighting between the first two, but it doesn't change the slides at ALL.

Thanks for your help!

I modified the function like this:

wsp_slideshow.prototype.gotoNextFrame = function()
{
var oldframe = this.currentFrame;
for(;;)
{
this.currentFrame = Math.floor(Math.random() * (this.images.length -1));
if (oldframe != this.currentFrame)
break;
}
this.gotoSpecificFrame(this.currentFrame);
}

person icon
niko
Moderator
Quote
2025-01-14 08:43:22

You are right, since RocketCake 5.5, this doesn't work anymore. If you change it like this it works again:

Search for this code:

wsp_slideshow.prototype.gotoNextFrame = function()
{
this.gotoSpecificFrame(this.currentFrame + 1);
}


and replace it with this:


wsp_slideshow.prototype.gotoNextFrame = function()
{
var nextFrame = 0;

for(;;)
{
nextFrame = Math.floor(Math.random() * (this.images.length));
if (nextFrame != this.currentFrame)
break;
}

this.gotoSpecificFrame(nextFrame);
}


person icon
ivarforkbeard
Registered User
Quote
2025-01-14 14:26:03

Niko, not sure if you hear it enough, but you're awesome.

Also: can you provide a mod so that the very first slide is also random?

Also: will this be included in V5.7 as a built in option?

emoji icon_grinemoji icon_grinemoji icon_grin

person icon
niko
Moderator
Quote
2025-01-15 08:17:18

For starting up with a random page:

search for


if (imageArr.length > 0)


and replace it with



startPage = Math.floor(Math.random() * imageArr.length);

if (imageArr.length > 0)


Yes, will think about making this an option.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |