Stefan
Stefan

Reputation: 1895

Jquery .find class not working

Why isn't this fiddle working?

http://jsfiddle.net/gupmgz0s/

I can't find the misstake in t his code does someone have a solution for this?

Thanks!

jquery:

$(".flip-container").find(".front").addClass("frontflip");


.flip-container:hover .front {
    transform: rotateY(0deg);
}
.flip-container:hover .back {
    transform: rotateY(180deg);
}

Does rotate the divs but when i use

.frontflip {
    transform: rotateY(0deg);
}
.backflip {
     transform: rotateY(180deg);
}

with the right fiddle code above it doesnt?

Does someone have a idea?

Upvotes: 0

Views: 2116

Answers (6)

mikelt21
mikelt21

Reputation: 2768

addClass must have a capital 'C'

Edit:

In response to your rotation issue, it looks like it does work but your frontflip class does a 0 degree rotation so nothing happens. If you change the addClass("frontflip") to addClass("backflip") then you'll see some changes.

See JSFiddle: http://jsfiddle.net/gupmgz0s/12/

Upvotes: 2

Stefan
Stefan

Reputation: 1895

.flip-container:hover .front {
    transform: rotateY(0deg);
}
.flip-container:hover .back {
    transform: rotateY(180deg);
}

Does rotate the divs but when i use

.frontflip {
    transform: rotateY(0deg);
}
.backflip {
    transform: rotateY(180deg);
}

with the right fiddle code above it doesnt?

Does someone have a idea?

Upvotes: 0

Hassan Baig
Hassan Baig

Reputation: 346

This fiddle is not working because you haven't included the Jquery in it.

and 'c' in addclass should be capital like 'addClass'

Upvotes: 1

Milind Anantwar
Milind Anantwar

Reputation: 82231

Two things:

1) You need to include jquery library.

2) You have incorrect syntax for addclass method. it should be:

 $(".flip-container").find(".front").addClass("frontflip");

Upvotes: 2

Vladimirs
Vladimirs

Reputation: 8599

This is not working because you are not referencing jquery in Frameworks & Extensions section

Upvotes: 1

Hackerman
Hackerman

Reputation: 12305

You fiddle doesn't have Jquery included, now it's working:

$(".flip-container").find(".front").addClass("frontflip");

Working fiddle: http://jsfiddle.net/robertrozas/e63ycx2k/1/

Upvotes: 1

Related Questions