FadeIn()

fadeIn() используется, чтобы реализовать проявление в скрытых элементах (например, элемент <div> скрытый).

Можно также использовать настройку скорости срабатывания.

<!DOCTYPE html>

<html>

<head>

<script src="https://code.jquery.com/jquery-latest.js">

</script>

<script>

$(document).ready(function () {

$("button").click(function () {

$("#div1").fadeIn();

$("#div2").fadeIn("slow");

$("#div3").fadeIn(3000);

});

});

</script>

</head>

<body>

<p>Demonstrate fadeIn() with different parameters.</p>

<button>Click to fade in boxes</button>

<br><br>

<div id="div1" style="width:80px;height:80px;display:none;backgroundcolor:red;"></div><br> <div id="div2" style="width:80px;height:80px;display:none;backgroundcolor:green;"></div><br> <div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>

</body>

</html>

FadeOut()

fadeOut() используется, чтобы реализовать скрытие элементов из зоны видимости.

<!DOCTYPE html>

<html>

<head>

<script src="https://code.jquery.com/jquery-latest.js">

</script>

<script>

$(document).ready(function () {

$("button").click(function () {

$("#div1").fadeOut();

$("#div2").fadeOut("slow");

$("#div3").fadeOut(3000);

});

});

</script>

</head>

<body>

<p>Demonstrate fadeOut() with different parameters.</p>

<button>Click to fade out boxes</button>

<br><br>

<div id="div1" style="width:80px;height:80px;background-color:red;"></div><br>

<div id="div2" style="width:80px;height:80px;background-color:green;"></div><br>

<div id="div3" style="width:80px;height:80px;background-color:blue;"></div>

</body>

</html>

Sliding методы

Реализацию движения по принципу слайдов можно выполнять с помощью методов:

· slideDown()

· slideUp()

· slideToggle()


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: