The div is not floating very well. I don't know where the problem lies.
依然
依然 2019-02-20 15:50:27
0
3
1140

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>jquery的动画效果</title>

<script type="text/javascript" src="jquery-3.3.1.min.js"></script>

<style type="text/css">

.mian{

height:240px;

width: 200px;

margin-right: 20px;

float:left;

}

.box1,.box2 {

height: 200px;

width: 200px;

background: red;

}

button{

height: 40px;

width: 200px;

border:none;}

</style>


<script type="text/javascript">

$(document).ready(function(){

$('.box1').hide()

$('.btu1').click(function(){

$('.box1').fadeIn(1500)

})

$('.btu2').click(function(){

$('.box2').fadeOut(1500)

})

})

</script>

</head>

<body>


<div class="mian">

<button class="btu1">淡入</button>

<div class="box1"></div>

</div>

<br>

<div>

<button class="btu2">淡出</button>

<div class="box2"></div>

</div>

</body>

</html>


依然
依然

reply all(1)
TT

Are you asking if the animation effect of this is not smooth enough?

  • reply The problem has been solved. It was caused by an extra <br> between the divs. Thank you for your reply.
    依然 author 2019-02-21 09:39:24
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template