$(this).parent().filter(".1") will do the following:  Take 'this' element
(the one being hovered over in this case) and find its parent (singular -
one parent, in the example HTML you posted this is <li class='extra'>), then
filter the results (a single element) looking for one with class='1', of
which there are none.  You'd need to look for children of the parent, with
something like $(this).parent().children(".1"), but far simpler would be
$(this).prev() to choose the previous sibling (would be restricted to the
DIV children of the LI in your example HTML) or $(this).prevAll() to choose
ALL previous siblings (still restricted to the children of the LI) at once.
So to affect all divs to the left of the hovered-over one, and the hovered
one itself, you could use something like this:

$(document).ready(function(){

$('div.rateblok').hover(function(){$(this).prevAll('rateblok').andSelf().addClass(hover);},

function(){$(this).prevAll('rateblok').andSelf().removeClass(hover);});
});

(the 'rateblok' inside prevAll() isn't necessary for your example, but would
filter out any children of the LI that did NOT have class 'rateblok')

j


On Sun, Jun 22, 2008 at 8:08 AM, Jasper Kennis <[EMAIL PROTECTED]>
wrote:

>
>
> I know the script isn't optimal, I'm planning on fine tuning it later,
> but for now, could someone tell my why selecting with $
> (this).parent().filter(".1") doesn't work?
>
> Tnx and greetings,
>
> Jasper Kennis
>

Reply via email to