jQuery secret weapon #2: Manipulating CSS and elements in the DOM
Now that we can reliably select any object our WordPress site displays on a page, let's start manipulating and enhancing our selections! We can manipulate our CSS styles which display our objects and as if that isn't cool enough, we can also manipulate the HTML objects themselves in the DOM. Let's get started with manipulating CSS.
Manipulating CSS
So far, everything that we've looked at regarding selectors and filters is essential for targeting the elements you want to affect. Now that you can select anything you want into the wrapper, let's start making stuff happen! Thanks to all of my previous examples, you're already familiar with the css()
function. Mostly, you'll use this function to assign standard CSS property values, such as: background, border, padding, margins
, and so on. If you can assign the property in a CSS stylesheet, you can assign it using the css()
function. You can also retrieve and get CSS properties with...