NFW
Posts: 5
Joined: Thu Dec 21, 2017 1:36 pm

Random Photo from Array

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
MisterNeutron
Posts: 440
Joined: Sun Aug 18, 2013 11:20 am

Re: Random Photo from Array

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.
Last edited by MisterNeutron on Fri Dec 22, 2017 2:30 am, edited 1 time in total.
NFW
Posts: 5
Joined: Thu Dec 21, 2017 1:36 pm

Re: Random Photo from Array

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...
MisterNeutron
Posts: 440
Joined: Sun Aug 18, 2013 11:20 am

Re: Random Photo from Array

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.
NFW
Posts: 5
Joined: Thu Dec 21, 2017 1:36 pm

Re: Random Photo from Array

That did it. Thank you so much for your help. I would have looked at that for weeks and never figured it out.

Return to “Highslide JS Usage”