JQuery实现父级选择器(广告实现)
2024-08-31 00:38:04
效果图如下:
HTML代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.left,.right{
position: fixed;
top: 250px;
}
.left{
left: 0;
}
.right{
right: 0;
}
.left span,.right span{
width: 20px;
height: 20px;
background: #ccc;
font-size: 14px;
color: #333;
position: absolute;
right: 0;
top: 0;
text-align: center;
cursor: pointer;
}
</style>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
$(function(){
$('span').click(function(){
$(this).parent().hide(500);
});
})
</script>
</head>
<body>
<div class="left"><img src="data:images/left.jpg" alt=""><span>X</span></div>
<div class="right"><img src="data:images/right.jpg" alt=""><span>X</span></div>
</body>
</html>
最新文章
- JAVA8 十大新特性详解
- The server does not support version 3.0 of the J2EE Web module specification
- 利用Qt Assistant 定制帮助文档
- poj1837 dp
- db2建立表空间
- 获得N位数字字母随机组合
- linux 下启动程序的时候会显示坏的解释器,或者没有那个文件
- JavaScript原型及继承
- Eclipse使用技巧 - 2. Eclipse自动补全功能轻松设置
- Microsoft Azure Tutorial: Build your first movie inventory web app with just a few lines of code
- GIL 全局解释器
- 如何查看memcache的性能
- SVM 核方法
- gtest测试代码编写思想
- mysql监控工具sqlprofiler,类似sqlserver的profiler工具
- c# 协变和逆变的理解
- 为Github 托管项目的访问添加SSH keys
- Ubuntu系统启动报错:The system is running in low-graphics mode
- python学习之老男孩python全栈第九期_day020知识点总结——序列化模块、模块的导入和使用
- BZOJ3325 [Scoi2013]密码【Manacher】【构造】【贪心】
热门文章
- SecureCRT中文乱码解决方案
- gulp 无损压缩图片
- DXperience Winforms新版本13.2功能预览
- Andoid Intent学习之在各个活动之间传递数据
- msql 综合练习
- hibernate 模拟实现和What is and Why O/R Mapping
- JavaScript 编写随机四位数验证码(大小写字母和数字)
- pat甲级1085
- php5.5.15注释问题PHP Deprecated: Comments starting with &#39;#&#39; are deprecated in *.ini 警告解决办法
- [转载]——Axure+SVN配置