The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’d like to make my jQuery a bit more smart by creating functions instead of repeating myself over and over. Take this code as an example:
Now, I’d like to do the very same two animations for another object plus I need the #button (what do you call this element in this example? Trigger?) to be something else. How will I do this best?
Have you seen the screen-casts on jQuery? I think the second one could help you out. Chris shows you how to make you own functions. I highly recommend it for solving your problem, if you haven’t already watched it.
https://css-tricks.com/video-screencasts … -jquery-2/
Check it out.