jquery - 页面加载后淡入按钮

标签 jquery css button fadein

我希望这个按钮在我加载页面时经过一段延迟后淡入。

我如何在 jQuery 中执行此操作?我怎样才能让我的其他按钮在延迟后也淡入淡出?

HTML:

<button class="button button2" id="button">Enter</button>

CSS:

.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-left: 500px;
margin-top: 150px;
transition-duration: 0.4s;
cursor: pointer;
font-weight: 5000;
}

.button2 {
background-color: transparent; 
color: white; 
border: 2px solid white;
}

.button2:hover {
background-color: white;
color: black;
font-weight: 800;
}

最佳答案

更改类选择器,或复制您希望用于不同元素的内容。您可以用逗号分隔多个类。 500代表半秒的等待时间,你也可以在fadeIn方法里面加一个值来改变速度。

$(function(){    
    setTimeout(function(){ 
        $('.button2').fadeIn();
    }, 500);
});

关于jquery - 页面加载后淡入按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50493077/

相关文章:

c# - 在 GridViewColumn 按钮的单击事件处理程序中获取绑定(bind)项

javascript - 捕获 Gmail 和其他阻止捕获的站点中的 TAB 键

html - 如何隐藏需要输入的消息 "please fill out this field"

jquery - Rail 保存到数据库编码的 html 并显示在 View 中

css新闻文章布局问题

css - 将 SVG 图标和文本置于同一个按钮的中心

python - 是否可以将文本隐藏在 Tkinter 的按钮/标签内?

点击 UIButton 时手指的 iOS x 坐标

jquery - 将OnClick Stop添加到音频

javascript - 使用窗口滚动将其更改为固定时保持元素位置