79 posts
  • Has been part of the Envato Community for over 2 years
  • Has collected 1+ items on Envato Market
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?

828 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+5 more
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>
79 posts
  • Has been part of the Envato Community for over 2 years
  • Has collected 1+ items on Envato Market
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?

79 posts
  • Has been part of the Envato Community for over 2 years
  • Has collected 1+ items on Envato Market
mattmatt88 says

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by