Source language: Translate to:

Execute a css code when I click on an image

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Execute a css code when I click on an image

Postby Palamar » Thu Feb 02, 2017 8:25 am

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!
Palamar
 
Posts: 157
Joined: Wed Apr 06, 2005 4:34 pm

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

Postby Gaev » Thu Feb 02, 2017 10:32 am

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'
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

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

Postby Palamar » Fri Feb 03, 2017 3:26 am

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!
Palamar
 
Posts: 157
Joined: Wed Apr 06, 2005 4:34 pm

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

Postby Gaev » Fri Feb 03, 2017 6:20 am

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.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

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

Postby luishp » Wed Feb 08, 2017 12:53 am

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
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

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

Postby Palamar » Wed Feb 08, 2017 7:41 am

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 ...
Palamar
 
Posts: 157
Joined: Wed Apr 06, 2005 4:34 pm


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron