John.Whelan Posted May 5, 2013 Share Posted May 5, 2013 Hi Everyone: I am having trouble with the JQuery Slide Toggle() method. Please refer to the code at: http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_slide_toggle What I want is for the flip element to change colour when the panel slides down and to return to the original colour when the panel slides up. I realize that I probably need the following elements: an If statement; the :hidden or :visible selector; and the jQuery css() method But I cannot figure out the proper syntax. Can anyone tell me what I need to add to the code at http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_slide_toggle to get this to work? Thanks in advance for whatever advice you can provide. John Link to comment Share on other sites More sharing options...
justsomeguy Posted May 6, 2013 Share Posted May 6, 2013 Check the documentation here, you can pass a function that will run when the animation completes: http://api.jquery.com/slideToggle/ The function can change the color. You can also change the color before or after the call to slideToggle and it will change the color when the animation starts instead of when it completes. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now