jq中三种显示及隐藏方法
来源:互联网 发布:贪吃蛇java小游戏代码 编辑:程序博客网 时间:2024/05/22 00:28
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
div{
width: 450px;
height: 200px;
background: red;
display: none;
}
</style>
<script src="js/jquery-1.11.1.min.js"></script>
<script>
/*
*整个方法最主要的就是fadein(),fadeout()显示及隐藏的方法,
* */
$(function(){
//点击显示时让盒子渐渐淡入
$("button").eq(0).click(function(){
$("div").fadeIn(2000);
});
$("button").eq(1).click(function(){
$("div").fadeOut(2000,function(){
//alert("动画完成");
});
});
//点击显示让盒子滑下
$("button").eq(2).click(function(){
$("div").slideDown(2000,function(){
//alert("动画完成");
});
});
$("button").eq(3).click(function(){
$("div").slideUp(2000,function(){
//alert("动画完成");
});
});
$("button").eq(4).click(function(){
$("div").show(2000,function(){
//alert("动画完成");
});
});
$("button").eq(5).click(function(){
$("div").hide(2000,function(){
//alert("动画完成");
});
});
})
</script>
</head>
<body>
<button>渐渐显示</button>
<button>渐渐隐藏</button>
<button>下滑显示</button>
<button>上滑隐藏</button>
<button>show显示</button>
<button>hide隐藏</button>
<div></div>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
div{
width: 450px;
height: 200px;
background: red;
display: none;
}
</style>
<script src="js/jquery-1.11.1.min.js"></script>
<script>
/*
*整个方法最主要的就是fadein(),fadeout()显示及隐藏的方法,
* */
$(function(){
//点击显示时让盒子渐渐淡入
$("button").eq(0).click(function(){
$("div").fadeIn(2000);
});
$("button").eq(1).click(function(){
$("div").fadeOut(2000,function(){
//alert("动画完成");
});
});
//点击显示让盒子滑下
$("button").eq(2).click(function(){
$("div").slideDown(2000,function(){
//alert("动画完成");
});
});
$("button").eq(3).click(function(){
$("div").slideUp(2000,function(){
//alert("动画完成");
});
});
$("button").eq(4).click(function(){
$("div").show(2000,function(){
//alert("动画完成");
});
});
$("button").eq(5).click(function(){
$("div").hide(2000,function(){
//alert("动画完成");
});
});
})
</script>
</head>
<body>
<button>渐渐显示</button>
<button>渐渐隐藏</button>
<button>下滑显示</button>
<button>上滑隐藏</button>
<button>show显示</button>
<button>hide隐藏</button>
<div></div>
</body>
</html>
阅读全文
0 0
- jq中三种显示及隐藏方法
- jq单击显示隐藏
- JQ显示与隐藏
- jq-产品显示与隐藏
- jQuery,JQ显示与隐藏
- mac 显示及隐藏文件的方法
- jq选择器及方法
- JQ简单的radio切换显示、隐藏
- JQ 点击隐藏再点击显示
- css与jq中的显示与隐藏
- JQ实现效果:滑动隐藏&滑动显示
- jq鼠标经过隐藏当前显示另一个
- [JQ权威指南]第十八天:使用show()与hide()方法动画显示和隐藏图片
- jq与JS点击显示隐藏二级菜单的几种方法
- 隐藏及显示文件夹
- XP下修正“显示隐藏文件夹及文件”方法
- jQ简单实现点击隐藏与显示内容
- jq写点击那个那个显示其他隐藏用到toggleClass
- jq中创建表格及删除事件
- 浅谈编程
- 数组的引用
- Linux 下 mysql 的安装 (编译源码的方式)
- Android 源码解析之WindowManager删除窗口
- jq中三种显示及隐藏方法
- lnmp “.user.ini”无法删除解决方法
- 两个变量交换的三种方法
- 沐枫NOI 21. Restoring Password
- 数据分析的统计学基础-假设检验
- Spring+SpringMVC+Mybatis+mysql整合详解
- 如何制作Ubuntu安装U盘
- HTML和CSS实例讲解
- List.clear方法——从列表中移除所有元素