开发者

Jquery Selectors + Syntax

I am trying to use a jQuery selector (this) to get an image nested on the same level. Just a syntax error, any help开发者_开发问答 would be appreciated. Thanks!

        $(this).addClass('on');
        $(this img).slideUp('fast');
        $(this img.accordionButtonActive).slideDown('fast');

http://jsfiddle.net/zBrhH/


You can't do $(this img). But you can pass a second parameter which defines the scope, try this:

$('img', this)...


I think you want the effect like this:

http://jsfiddle.net/expertCode/zBrhH/

using:

    $(this).addClass('on');
    $('img', this).slideUp('fast');
    $('img.accordionButtonActive', this).slideDown('fast');

I changed some events too. Try it ;)


    $(this img).slideUp('fast');

should be

    $(this).find("img").slideUp('fast');

Demo, with working accordion: http://jsfiddle.net/zBrhH/2/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜