I have a quick jquery-question. I’ve got the following function
$('#post-1', this).hover(function() {
But I want the function for all posts, not just for post #1. It doesn’t work if I type ”#post” or ”#post-” etc.
Can you help me?
you will need to add a new class to the posts e.g. class=”hover”.
You will then be able to attack every post with that class.
I am guessing this is in WordPress which might be using the following to give current ID
<div id="post-<?php the_ID(); ?>"> // code here </div>
So just add a class onto the end before the final > e.g.
<div id="post-<?php the_id(); ?>" class="class-name"> // code here </div>
Shame on me that I haven’t checked this out by myself. thanks.
But I have another syntax problem. I have a Variable “imgwidth” that I want to include in the wrap function. It doesn’t work like that:
$(this).wrap('<div style="background-color:#000; width:', imgwidth ,';">');
It also doesn’t work with “"” instead of the “
Do you have an idea?
