Animated Thumbnail Gallery Support Product Page

Answered

Automated Display of Image

Asked 03 Dec 2011 01:45:37
1
has this question
03 Dec 2011 01:45:37 Wayne Freeman posted:
Hi, I need to be able to automatically select an image to display using the viewer.

I have tried a javascript function to fire a click event on the generated href anchor for a thumbnail, but for some reason that bypasses the ATG code and all that happens is that the image gets displayed on a new page. I guess ATG is watching for a physical click on a thumbnail.

Would it be possible to call the viewer function directly, and if so, would you please tell me what function that is?

Thanks,

Wayne

Replies

Replied 05 Dec 2011 15:07:25
05 Dec 2011 15:07:25 Miroslav Zografski replied:
Hello Wayne,

Try using the Control Thumbnail gallery Behavior that can be found in BEHAVIORS panel in TAG INSPECTOR.
Replied 05 Dec 2011 21:06:50
05 Dec 2011 21:06:50 Wayne Freeman replied:
Thanks for the suggestion, Miroslav.

Unfortunately, I can't make that work properly. First of all, the behavior added this to the <div> tag for "dmxGenId_1":

onFocus="dmxControlThumbnailGallery('dmxGenId_1', 'show', 5)"

but it should have put single quotes around the anchor ID:

onFocus="dmxControlThumbnailGallery('dmxGenId_1', 'show', '5')"

So I fixed that.

Even so, the onFocus event doesn't seem to fire in any browser except for IE9 in Windows (other IE versions, too, I suppose), and even then it only fires if I click the mouse somewhere inside the gallery region.

The onFocus event would be okay if it worked cross-browser and didn't require user intervention. Other events, like onDblClick, work as expected, but obviously require user intervention. The requirement is no user intervention.

It would be great if I could call dmxControlThumbnailGallery() directly, but would need a way to be able to tell when the Viewer object was instantiated. If I just call it when the page is loaded, the thumbnails haven't yet displayed and the Viewer object is as yet undefined.

Is some event fired when the gallery is finished instantiating?

Thanks,





Edited by - Wayne Freeman on 06 Dec 2011  05:25:00
Replied 09 Dec 2011 03:58:34
09 Dec 2011 03:58:34 Wayne Freeman replied:
I still don't know of any events that trigger when the Gallery object is completely instantiated, but found a workaround:

<script type="text/javascript" language="javascript">
window.setTimeout(function() {
dmxControlThumbnailGallery('dmxGenId_1', 'show', '<?php echo $autoDispSeq ?>');
}, 1000);
</script>

Waiting for one second allows enough time, as near as I can tell, for the Gallery object to instantiate so the Viewer is ready when the dmxControlThumbnailGallery() function is called.

It may not work in all cases, however, so I'd still like to know if there is a way to tell for sure when the Gallery object is ready.

Thanks,
Replied 23 Jan 2012 13:16:00
23 Jan 2012 13:16:00 Miroslav Zografski replied:
Hello Wayne,

All available events are set in the behaviors connector that is accessible trough the thumbnail Behaviors paperclip icon.
There is a Gallery Loaded event on which you can assign a custom function or a preset Behavior.

Regards.

Reply to this topic