Page 1 of 1

Random Photo from Array

Posted: Thu Dec 21, 2017 1:54 pm
by NFW
I have an array that selects a random photo. When executed, it finds the thumb with no problem. However, when clicked, all I get is the "Loading" spinner. If I click on that, it bails out as it should. If I click on the thumb image, it loads the image, but not in HighSlide. I know I've done something stupid, but for the life of me, I can't find it.

There is a test page at: http://www.northfloridawoodworking.com/test.html.

Browsers: Chrome, Firefox, Edge
OS: Windows 10, Android

Thanks for anyone that can give me a hand with it.

Regards,
Sam Rogers

Re: Random Photo from Array

Posted: Thu Dec 21, 2017 3:48 pm
by MisterNeutron
Looks like hs.graphicsDir isn't defined. The basic concept does work: (demo page removed)

But you're going to run into problems if you intend to support mobile devices. The expander doesn't really behave properly, especially in portrait mode. Try my demo in Chrome on Android, and you'll see what I mean. And BTW, if you don't set some 100% heights on html and body, the dimming background doesn't behave, either.

A couple of unrelated notes...

In HTML5, there's no longer any reason to provide a type or language attribute on a <script> tag - it defaults to text/javascript. And the self-closing slash on the <link> tag is a leftover from XHTML.

Don't bother with any of the subsets of Highslide JS, like highslide-with-gallery.js. You'll just end up chasing phantoms. Use the full script all the time, either highslide-full.js or highslide-full.min.js, which is just a minified version of the same thing.

Re: Random Photo from Array

Posted: Thu Dec 21, 2017 9:14 pm
by NFW
I cleaned up the code as you suggested, and added the path to graphics dir. It's still not working. Still doing the same thing. Thank you for trying though...

Re: Random Photo from Array

Posted: Thu Dec 21, 2017 11:02 pm
by MisterNeutron
A classic Highslide mistake, one that the online editor actually creates. I'd forgotten about this one, and it's tripped up hundreds of users before you! This is on your page:

Code: Select all

hs.outlineType = 'custom';
But there's no custom.png outline available. For now, just delete that line. If you want to use an outline, make sure it's one of the ones that's actually present in the highslide/graphics/outlines directory, like beveled or rounded-white.

Re: Random Photo from Array

Posted: Fri Dec 22, 2017 12:56 am
by NFW
That did it. Thank you so much for your help. I would have looked at that for weeks and never figured it out.