Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

on/off image

hi, how can i set an image as an on/off switch (toggle)? what i mean is to have two images, display imageA and when click on it to display ImageB click again and display imageA etc etc. I tried by trying to set the asset property via the appery interface but nothing happens.
any ideas? thanx

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

on/off image

Hello! You would need to upload images to assets and on click on image run the following JS:
codeif ($(this).attr("src").indexOf('img1.png') > 0) {
$(this).attr("src", Appery.getImagePath("img2.png"))
} else {
$(this).attr("src", Appery.getImagePath("img1.png"))
}/code
where img1.png, img2.png - images names

Return to “Issues”