Change Text in swipegallery when the image changes

122 views
Skip to first unread message

donat...@gmail.com

unread,
Oct 27, 2015, 5:37:32 AM10/27/15
to Google Web Designer beta
Hi GWD Community,

I have the following problem:

I added a normal swipegallery with 6 different images and now I would like that, when I slide through the gallery everytime another text appears. For example: when I swipe to image 1 text a should appear and when I swipe to image 2 text b should appear and so on.

Thanks in advance.

San Khong

unread,
Oct 27, 2015, 1:36:50 PM10/27/15
to Google Web Designer beta

Here is an example on showing text/caption for each frame in the Swipable gallery

  1. Add the swipable gallery on stage

  2. Set the images

  3. Draw a div and give it my-div as id in the Properties panel.

  4. Add the following event:

Target= the gallery

Event = Frame shown

Action = customAction

CustomCode =  

var gallery = document.getElementById('gwd-swipegallery_1');

var div = document.getElementById('my-div');

var text = {

 1: "The text for frame 1",

 2: "The text for frame 2",

 3: "The text for frame 3"

};

div.textContent = text[gallery.currentIndex];


Note: gwd-swipegallery_1 is the id of the gallery, and my-div is the id for the div to show the caption


Hope it helps.
San
Reply all
Reply to author
Forward
0 new messages