div浮动不是很好,不知道问题出在哪
依然
依然 2019-02-20 15:50:27
[jQuery讨论组]

<!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>


依然
依然

全部回复(1)
TT

你是想问这个做的动画效果不够流畅吗?

  • 回复 问题已解决,div之间多了个<br>导致的,谢谢回复
    依然 作者 2019-02-21 09:39:24
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号