gpt4 book ai didi

jQuery 边框动画

转载 作者:太空宇宙 更新时间:2023-11-04 00:10:47 25 4
gpt4 key购买 nike

我正在尝试使用边框和 jQuery 动画功能为按钮点击设置动画。

jQuery( '#sendForm' ).hover( function (){
jQuery( this ).animate({
borderTopWidth: "5px",
borderBottomWidth: "0px"
}, 'fast' );
}, function (){
jQuery( this ).animate({
borderTopWidth: "0px",
borderBottomWidth: "5px"
}, 'fast' );
});

出于某种原因,它不会仅对底部边框设置动画。

更新

.submitButton { 
padding: 10px;
border: 0px;
border-bottom: 5px solid #1B5A81;
background-color: #267DAD;
color: white;
font-weight: bold;
}

最佳答案

如果您愿意,也可以使用 CSS3 过渡来完成同样的事情 Demo

HTML

<button>BlahBlah</button>

CSS

    button {
border-top: 5px solid #ff0000;
border-bottom: 0px solid #ff0000;
transition: border-top 2s, border-bottom 2s;
-moz-transition: border-top 2s, border-bottom 2s; /* Firefox 4 */
-webkit-transition: border-top 2s, border-bottom 2s;; /* Safari and Chrome */
-o-transition: border-top 2s, border-bottom 2s; /* Opera */
}

button:hover {
border-top: 0px solid #ff0000;
border-bottom: 5px solid #ff0000;
transition: border-top 2s, border-bottom 2s;
-moz-transition: border-top 2s, border-bottom 2s; /* Firefox 4 */
-webkit-transition: border-top 2s, border-bottom 2s;; /* Safari and Chrome */
-o-transition: border-top 2s, border-bottom 2s; /* Opera */
}

CSS3 过渡 w3 link

关于jQuery 边框动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13135852/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com