tags:

views:

12

answers:

0

Quick question on jquery position. On a page, I have multiple divs with class of .ex-head, and in each div is an img element and an h2. I want to vertically align the img and h2 elements in each div with class of .ex-head. The h2 is on the left, the img on the right.

$(".ex-head img").position({
        my: "left center",
        at: "right center",
        of: $(this).prev('.ex-head h2')
});

I also tried

$(".ex-head h2").next('img').position({
        my: "center center",
        at: "center center",
        of: $(this)
    });

This doesn't seem to be working though. What's the best way to do this?