2017-10-05 89 views
0

我打算将我网站上的所有input[type=submit] s & button s更改为此流畅的动画流动按钮。如何创建一个流畅的动画流动按钮?

那么,我该如何使用HTML创建此JavaScript?& CSS?特别是我让这个GIF在Stack Overflow中发布。我不认为,我必须在这个问题上发表一些代码来解释它。 :/

Smooth

编辑:我不想右下角正好卷发效果左上角。它应该从我点击的区域开始影响。在下一个GIF中,我点击了中间。现在请看看影响。

Flowing

我希望你能明白我的意思。 它应该从我点击的确切区域开始流向外部。

+0

与右下角正好卷发效果左上角? –

回答

0

您可以使用hover.css,Checkout后台转换中的那个 http://ianlunn.github.io/Hover/。 如果你想完全像你发布的那个。你总是可以尝试一些试错与hover.css

0

,你可以很容易地用简单的CSS让看到这个click

0

希望这有助于!

.button { 
 
    position: relative; 
 
    background-color: #4CAF50; 
 
    border: none; 
 
    font-size: 28px; 
 
    color: #FFFFFF; 
 
    padding: 20px; 
 
    width: 200px; 
 
    text-align: center; 
 
    -webkit-transition-duration: 0.4s; /* Safari */ 
 
    transition-duration: 0.4s; 
 
    overflow: hidden; 
 
} 
 

 
.button:after { 
 
    content: ""; 
 
    background: #90EE90; 
 
    display: block; 
 
    position: absolute; 
 
    padding-top: 300%; 
 
    padding-left: 350%; 
 
    margin-left: -20px!important; 
 
    margin-top: -120%; 
 
    opacity: 0; 
 
    transition: all 0.8s 
 
} 
 

 
.button:active:after { 
 
    padding: 0; 
 
    margin: 0; 
 
    opacity: 1; 
 
    transition: 0s 
 
}
<button class="button">Click Me</button>

0

请检查这一点,希望这是有帮助的。

a { 
 
padding: 20px 30px; 
 
line-height:30px; 
 
color:#fff; 
 
font-size: 20px; 
 
background:#ff0000; 
 
text-decoration: none; 
 
position: relative; 
 
transition: all ease .6s; 
 
overflow:hidden; 
 
display: inline-block; 
 
} 
 

 
a span { 
 
z-index:1; 
 
position:relative; 
 
} 
 
a:after { 
 
transform: scale(0); 
 
background: #000; 
 
position: absolute; 
 
right:-200px; 
 
bottom:-200px; 
 
content:''; 
 
border-radius: 100%; 
 
transition: all ease .6s; 
 
width: 400px; 
 
height: 400px; 
 
} 
 

 
a:hover:after { 
 
    transform:scale(1); 
 
    transition: all ease .6s; 
 
}
<a href="#"><span>Test</span></a>

0

可以通过从 “Abhitalks” 回答一个小的调整,从this question可以实现!

在HTML:

​​

CSS:

.outer_box{ 
    background-color: transparent; 
    width: 400px; 
    height: 400px; 
    position: relative; 
    border: 1px solid silver; 
    text-align:center; 
    } 

#dummy { 
    position: absolute; 
    top: 400px; left: 400px; 
    width: 1px; height: 1px; 
    background-color: gray; 
    z-index: -5; 
} 

脚本:

$('#btn').on("click", function() { 
    $('#dummy').animate({ 
     'width': '400px', 
     'height': '400px', 
     'top': '0px', 
     'left': '0px' 
    }, 500);  
    //and any action to be done on click :) 
}); 
你想