Page 1 of 1

Execute a css code when I click on an image

PostPosted: Thu Feb 02, 2017 8:25 am
by Palamar
Hi, Is there any way that when I click on an image it will execute a css code ?. I explain: I have an effect that by placing it in Application Properties> Styles, causes an image to rotate by mouseover (and indicating the ID). What I want is for the rotation to take place when the user clicks on the image. With the Rotate function of NeoAppBuilder does not work the same (it is very abrupt change), in contrast with the routine is much smoother. The problem is that CSS does not allow it, just visited or hover, and I would need something like onClic :)

Thank you!

Re: Execute a css code when I click on an image

PostPosted: Thu Feb 02, 2017 10:32 am
by Gaev
Palamar:

Is there any way that when I click on an image it will execute a css code ?.

I did a Google search using phrase javascript to change css ... and it returned http://www.w3schools.com/js/js_htmldom_css.asp ... so you can place appropriate javascript code in your Image Object's onClick event routine.

http://www.w3schools.com/jquery/css_css.asp shows you how to do this using jQuery (built into NeoAppBuilder).

I have an effect that by placing it in Application Properties> Styles, causes an image to rotate by mouseover (and indicating the ID). What I want is for the rotation to take place when the user clicks on the image. With the Rotate function of NeoAppBuilder does not work the same (it is very abrupt change), in contrast with the routine is much smoother. The problem is that CSS does not allow it, just visited or hover, and I would need something like onClic :)

Post the css that works with hover ... perhaps the same css can be setup for another class e.g. 'isClicked' ... and then the javascript code in the object's onClick event can just change the object's class to 'isClicked' ... of course, you will need another event to change the class back to something like 'isNotClicked'

Re: Execute a css code when I click on an image

PostPosted: Fri Feb 03, 2017 3:26 am
by Palamar
Hey, thanks. I have been able to do something by mixing css and js and it has worked. I will have to see that, instead of changing a single parameter, change the whole class (or execute one, for example, a class that has an animation). Regards!

Re: Execute a css code when I click on an image

PostPosted: Fri Feb 03, 2017 6:20 am
by Gaev
Palamar:

jQuery provides functionality to perform a custom animation of a set of CSS properties. ...examples on this page ... http://api.jquery.com/animate/ ... might help you achieve your goals.

Re: Execute a css code when I click on an image

PostPosted: Wed Feb 08, 2017 12:53 am
by luishp
Take a look at JQuery addClass() and removeClass() methods:
http://www.w3schools.com/jquery/jquery_ref_html.asp

Also try my "PowerApp" plugin as it has a lot of usefull functions.
Regards

Re: Execute a css code when I click on an image

PostPosted: Wed Feb 08, 2017 7:41 am
by Palamar
Gracias a Luishp y Gaev por el dato, estoy viendo todo, desde ya he logrado lo que necesitaba con js...:)


Thanks to Luishp and Gaev for the data, I'm seeing everything, from what I already achieved what I needed with js ...