V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
o618
V2EX  ›  问与答

鼠标划过头像一闪而过的效果是怎么实现的?

  •  
  •   o618 · 2014-02-07 09:44:24 +08:00 · 2303 次点击
    这是一个创建于 3774 天前的主题,其中的信息可能已经有所发展或是发生改变。
    谁知道?
    8 条回复    1970-01-01 08:00:00 +08:00
    justfindu
        1
    justfindu  
       2014-02-07 10:03:47 +08:00   ❤️ 1
    https://gist.github.com/RJustice/8856273

    <div class="arc_img">
    <a href="#">
    <img src="test.png" alt="LEE图库">
    </a>
    <i class="light"></i>
    </div>

    skewx是在X轴上做了负25度的变形,背景颜色用的是CSS3的线性渐变,然后hover的时候,设置0.2s的动画时间。

    同时因为图像是有链接的,所以在透明层i标签使用了cursor:pointer,不然会等闪光划过之后,才能看见手指状。

    当然了,CSS3 的效果嘛,IE低版本肯定不支持了。其实也可以做,这恐怕又得结合JS了~


    哦 我是抄来的~
    justfindu
        2
    justfindu  
       2014-02-07 10:06:45 +08:00
    justfindu
        3
    justfindu  
       2014-02-07 10:08:53 +08:00
    justfindu
        4
    justfindu  
       2014-02-07 10:09:03 +08:00
    .arc_img{
    width: 160px;
    height: 160px;
    position: relative;
    display: block;
    overflow: hidden;
    margin:200px auto;
    box-shadow: 0 0 10px #FFF;
    }
    .light{
    cursor:pointer;
    position: absolute;
    left: -100px;
    top: 0;
    width: 160px;
    height: 160px;
    background-image: -moz-linear-gradient(0deg,rgba(255,255,255,0),rgba(255,255,255,0.5),rgba(255,255,255,0));
    background-image: -webkit-linear-gradient(0deg,rgba(255,255,255,0),rgba(255,255,255,0.5),rgba(255,255,255,0));
    transform: skewx(-25deg);
    -o-transform: skewx(-25deg);
    -moz-transform: skewx(-25deg);
    -webkit-transform: skewx(-25deg);

    }
    .arc_img:hover .light{
    left:120px;
    -moz-transition:0.2s;
    -o-transition:0.2s;
    -webkit-transition:0.2s;
    transition:0.2s;
    }
    o618
        5
    o618  
    OP
       2014-02-07 10:12:09 +08:00
    @justfindu 通过css实现的?不知道哪里能看到演示效果
    justfindu
        6
    justfindu  
       2014-02-07 10:36:49 +08:00   ❤️ 1
    @o618 http://music.baidu.com/ 专辑那个效果么~ 这就是~
    Chappako
        7
    Chappako  
       2014-02-07 21:43:14 +08:00
    @justfindu 网易音乐就没有专辑的概念好么
    o618
        8
    o618  
    OP
       2014-02-08 08:54:42 +08:00
    楼上说的是百度音乐,谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2380 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:24 · PVG 23:24 · LAX 08:24 · JFK 11:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.