图片点击翻转效果

此处写法是

css===写好样式放在一个新class名

1 @keyframes flipping{
2     from{transform:rotateY(0);}
3     to{transform:rotateY(180deg);}
4 }
5 .active{
6     animation: flipping .6s ease-in;
7 }

js===点击时给要翻转的元素添加class名称。

$(function(){
    $("#gold li img").click(function(){
        // $(this).addClass("active")
        this.className="active"
       
    //此处有$(this)和this,使用注意事项
    //可到此链接查看:https://www.cnblogs.com/gfl123/p/8080484.html
    })
})

 

posted @ 2018-09-06 18:38  Millet_23  阅读(1046)  评论(0编辑  收藏  举报