-1

I need that when a user click a button. The dress changes. There are separate files for the dress and the body.

I added a custom code on a tap/click event on GWD which is this

document.getElementById("body").src = "Skin-Fair(Ivory).png";
document.getElementById("body").source = "Skin-Fair(Ivory).png";

What happens is that there is a placeholder when I click the button but it never makes the intended image appear.

  • 2
    Please provide a minimal example of the current code and what you've tried so far. Read more: https://stackoverflow.com/help/how-to-ask – rafaelcastrocouto Mar 26 '18 at 19:09
  • 1
    I added a custom code on a tap/click event on GWD which is this document.getElementById("body").src = "Skin-Fair(Ivory).png"; document.getElementById("body").source = "Skin-Fair(Ivory).png"; What happens is that there is a placeholder when I click the button but it never makes the intended image appear. – Jeff Valerio Mar 28 '18 at 01:33

2 Answers2

0

This is a minimum example of how to change an image source with a button.

I strongly recommend you take a basic web dev course: https://github.com/bmorelli25/Become-A-Full-Stack-Web-Developer

document.getElementById('bt').addEventListener('click', function () {
  document.getElementById('im').src = 'https://placeholdit.imgix.net/~text?txtsize=18&bg=FF6347&txtclr=ffffff&txt=New-Image&w=250&h=50';
});
<button id="bt">Button</button>
<img id="im" src="https://placeholdit.imgix.net/~text?txtsize=18&bg=FF6347&txtclr=ffffff&txt=Placeholder-Image&w=250&h=50">
rafaelcastrocouto
  • 11,781
  • 3
  • 38
  • 63
0

No coding skills required for that using GWD.

I assume you have imported all your images in GWD project.

You should use the timeline and create two different keyframes. Set the opacity to 0 to hide the unwanted assets in your keyframes.

Add an event on tap/click and set it to go to the keyframe/page you want.

fat_mike
  • 877
  • 12
  • 27