I didn’t realize that you didn’t HAVE to use normal CSS syntax in jQuery! By default you only have to use single apostrophes when the value has hyphen in the name. If I’ve completely lost you let’s look at some code.
Please note lines 3 and 4. The CSS values “margin-left” and “margin-top” are surrounded by ‘s. Most people don’t know that there is a shorthand method that I think looks much better (IMO) and saves you a few keystrokes. Using “camelCased” coding you can change the jQuery code into this:
As you can see you can remove the ‘ and the – but you HAVE to uppercase the second word’s first initial. I like using this because not only does it save keystrokes I also find it also helps me with closing the ‘s! Hopefully this trick will help you with jQuery’s most versatile function.
As a bonus I figured I through in another example:
This time you cane see that I used “paddingLeft” instead of “padding-left”. This code basically will take the paragraph element and slide it to the right 200px when you hover over it. It will slide back to it’s original spot when you take the mouse off.