Target elements in Group in Swipeable Gallery

36 views
Skip to first unread message

stevej...@gmail.com

unread,
Apr 17, 2017, 3:48:17 PM4/17/17
to Google Web Designer beta
I have a Swipeable gallery which is loading in groups.

Im trying to target the css property of an image inside of a group that is being loaded inside of the swipe gallery.

Gallery ID: gallery
Group: image1
Element ID: headline1

Im basing this off of the forum post here:
https://groups.google.com/forum/#!starred/gwdbeta/doWWITS6sBI

I thought that targeting the headline as shown below would work but I just keep getting
"Uncaught ReferenceError: headline1 is not defined"

gwd.switch=function(event){
switch (this.currentIndex) {
case 1:
gallery.image1.headline1.style.transition = "opacity 0.5s ease-in 0s";
gallery.image1.headline1.style.opacity = 1;
break;
case 2:
gallery.image1.headline1.style.opacity = 0;
break;
case 3:
break;
}
}

Help me obi-wan, you're my only hope.

San Khong

unread,
Apr 17, 2017, 6:24:37 PM4/17/17
to Google Web Designer beta
Hi Steve,

It will not work because Google Web Designer has our own way of keeping the ids so you can't just access the element inside the group in the gallery using the dot notation like.  However, what you are trying to do is supported in the gwd events/actions so you can try something like this:

gwd.switch=function(event){
switch (this.currentIndex) {
  case 1:
    gwd.actions.events.setInlineStyle('image1 headline1', 'transition: all 0.5s ease-in; opacity: 1;');
    break;
  case 2:
    break;
  case 3:
    break;
}
}

San
Google Web Designer team
Reply all
Reply to author
Forward
0 new messages