2

I attempting to create a flip transition which can been seen Here i want this function to activate when the user click on the info button, however i can not seem to target the .card class in order to activate the flip transition.

below is a snippet of my jquery

 $('.active-btn').click(function(){
            $(this).closest('.card').find('.flip')
            .addClass('flipped').mouseleave(function(){
        $(this).removeClass('flipped');
    });
    return false;
});
2
  • 1
    The html would help, maybe the problem is about the dom. Commented Sep 3, 2015 at 16:26
  • 1
    Your fiddle is broken: Uncaught ReferenceError: $ is not defined Commented Sep 3, 2015 at 16:27

3 Answers 3

4

fiddle
Removing .find('.flip') should help, cause you're interested in flipping the .card

$(this).closest('.card').addClass('flipped').mouseleave(function(){
Sign up to request clarification or add additional context in comments.

Comments

0

.find('.flip') will look for element with find class inside .card element, which is not the case per your HTML. As suggested by @Roko : it would help if you remove the .find('.flip') from your script. Also, I see that you have not handled the transform property in css for all the browser, it would be better if you address all the browsers for transform,

-webkit-transform: rotateY(-180deg);
-moz-transform:    rotateY(-180deg);
-ms-transform:     rotateY(-180deg);
-o-transform:      rotateY(-180deg);
transform:         rotateY(-180deg);

Comments

-1

Instead of using closest, and find for the .card class, just use the .card class as the selector.

$('.card').addClass('flipped').mouseleave(function()

You'll select any element with .card class, and add the class flipped.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.