如何改变鼠标移动的渐变位置?

时间:2015-01-08 06:06:35

标签: html5 css3 canvas html5-canvas

我正在尝试在网站上构建更多用户互动。由于我的网站有渐变,我的灵感来自于鼠标悬停在事物网站http://www.impossible-bureau.com/上时渐变的移动方式。

如果任何人可以帮助我使用代码来做同样的背景效果会很棒!

1 个答案:

答案 0 :(得分:0)

看一下这个快速小提琴的例子,没有涉及到JS(你需要做很多工作才能拥有像他们一样平滑和美观的东西,但我不会在背景中看到任何动作:)前景有不同的状态):



*
{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    background-image: url(http://upload.wikimedia.org/wikipedia/commons/4/49/Zdiar1.jpg);
    background-size: 100% 100%;
    color: white;
    font-size: 1.5rem;
    font-family: "Segoe UI";
}

div
{
    background-color: darkblue;
    height: 100%;
    width: 25%;
    float: left;
    padding: 1rem;
    transition: .5s ease;
}

div:nth-of-type(4)
{
    background-color: darkblue;
}

div:hover
{
    background-color: transparent;
}

<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium ipsa vitae quidem quod soluta vel impedit eligendi eius minus quis optio recusandae numquam iure laborum voluptatum facilis cum similique excepturi.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium ipsa vitae quidem quod soluta vel impedit eligendi eius minus quis optio recusandae numquam iure laborum voluptatum facilis cum similique excepturi.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium ipsa vitae quidem quod soluta vel impedit eligendi eius minus quis optio recusandae numquam iure laborum voluptatum facilis cum similique excepturi.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium ipsa vitae quidem quod soluta vel impedit eligendi eius minus quis optio recusandae numquam iure laborum voluptatum facilis cum similique excepturi.</div>
&#13;
&#13;
&#13;