Jquery教程
Jquery动效
Jquery HTML/CSS
Jquery 事件
jquery常用

JQuery fadeIn()

JQuery fadeIn()

JQuery fadeIn()方法用于淡入元素。
语法:
$(selector).fadein();
$(selector).fadeIn(speed,callback);
$(selector).fadeIn(speed, easing, callback);
speed: 这是一个可选参数。它指定延迟的速度。可能的值是慢,快和毫秒。
easing: 它指定用于过渡的缓和功能。
callback: 也是可选参数。它指定了fadein()效果完成后要调用的函数。
让我们以一个示例来演示JQuery fadeIn()效果。
<!DOCTYPE html>
<html>
<head>
<script src="/ajax/libs/JQuery/1.11.2/JQuery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("#div1").fadeIn();
        $("#div2").fadeIn("slow");
        $("#div3").fadeIn(3000);
    });
});
</script>
</head>
<body>
<p>请参见带有不同参数的fadeIn()方法示例。</p>
<button>单击以在框中淡入淡出</button><br><br>
<div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>
</body>
</html>
输出:

请参见带有不同参数的fadeIn()方法示例。

昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4