63 posts
  • Bought between 1 and 9 items
  • Has been a member for 2-3 years
mattmatt88 says

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?

454 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • United Kingdom
Gareth_Gillman says

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>
63 posts
  • Bought between 1 and 9 items
  • Has been a member for 2-3 years
mattmatt88 says

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 “&quot” instead of the “

Do you have an idea?

63 posts
  • Bought between 1 and 9 items
  • Has been a member for 2-3 years
mattmatt88 says
by
by
by
by
by
by