2017-10-05 95 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 :) 
}); 
你想