博客
关于我
jQuery带有呼吸的缩略图(含完整源码)
阅读量:179 次
发布时间:2019-02-28

本文共 2266 字,大约阅读时间需要 7 分钟。

本博文源于jQuery基础,旨在实现带有呼吸的缩略图。

实验效果

在这里插入图片描述

实验步骤

测试用图

点击图片另存为如下图的文件结构

在这里插入图片描述
请添加图片描述请添加图片描述请添加图片描述请添加图片描述请添加图片描述请添加图片描述请添加图片描述请添加图片描述

small文件夹下的图片

同样以数字命名

在这里插入图片描述
请添加图片描述请添加图片描述请添加图片描述请添加图片描述请添加图片描述

书写html结构

大家回想html里面用到了什么?

第一个div中li模拟大图片,第二个div模拟大标题,第三个就是缩小版的图,左右按钮也考虑,中间小图片要有背景比如这种,
在这里插入图片描述
因此html代码如下:

书写css代码

书写的时候就是把浮动,把各种大小考虑进去,如下结构

* {   	margin: 0;	padding: 0;}.carousel {   	width: 651px;	height: 365px;	border: 1px solid #333;	margin: 100px auto;	position: relative;}.carousel .carousel_images ul {   	list-style: none;	position: relative;}.carousel .carousel_images ul li {   	width: 651px;	height: 365px;	background-position: center center;	position: absolute;	top: 0;	left: 0;	display: none;}.carousel .carousel_images ul li.first{   	display: block;}.small_nav {   	position: absolute;	width: 100%;	height: 120px;	background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4) 35%, rgba(0, 0, 0, 0.99));	bottom: 0;	left: 0;}.small_nav .inner {   	width: 646px;	height: 54px;	position: absolute;	bottom: 20px;	left: 50%;	margin-left: -323px;	z-index: 2;}.small_nav .inner .left_btn {   	float: left;	width: 31px;	height: 54px;	background: url(../images/prev.png) center center;}.small_nav .inner .right_btn {   	float: right;	width: 31px;	height: 54px;	background: url(../images/next.png) center center;}.small_nav .inner .small_nav_pics {   	float: left;	width: 567px;	height: 58px;	margin-left: 17px;	overflow: hidden;}.small_nav h3{   	padding-left: 30px;	font-size: 24px;	color:white;	line-height: 30px;}.small_nav .inner .small_nav_pics ul.small_nav_unit {   	list-style: none;	position: relative;	width: 5000px;}.small_nav .inner .small_nav_pics ul li {   	float: left;	width: 92px;	height: 40px;	margin-right: 20px;	padding: 7px 2px;}.small_nav .inner .small_nav_pics ul li img {   	width: 92px;	height: 45px;}.small_nav .inner .small_nav_pics ul li.cur {   	background: url(../images/lion.png);}

书写js代码

左右按钮,还有缩率图的事件进行监听,这部分要注意的。

总结

在制作这个特效时,左右按钮的事件监听一定要注意,会发生什么,图片会动缩略图会动,当单击缩率图时,大图会动,也要考虑,最后代码运行,收获喜悦。

转载地址:http://iard.baihongyu.com/

你可能感兴趣的文章
multipart/form-data与application/octet-stream的区别、application/x-www-form-urlencoded
查看>>
mysql cmake 报错,MySQL云服务器应用及cmake报错解决办法
查看>>
Multiple websites on single instance of IIS
查看>>
mysql CONCAT()函数拼接有NULL
查看>>
multiprocessing.Manager 嵌套共享对象不适用于队列
查看>>
multiprocessing.pool.map 和带有两个参数的函数
查看>>
MYSQL CONCAT函数
查看>>
multiprocessing.Pool:map_async 和 imap 有什么区别?
查看>>
MySQL Connector/Net 句柄泄露
查看>>
multiprocessor(中)
查看>>
mysql CPU使用率过高的一次处理经历
查看>>
Multisim中555定时器使用技巧
查看>>
MySQL CRUD 数据表基础操作实战
查看>>
multisim变压器反馈式_穿过隔离栅供电:认识隔离式直流/ 直流偏置电源
查看>>
mysql csv import meets charset
查看>>
multivariate_normal TypeError: ufunc ‘add‘ output (typecode ‘O‘) could not be coerced to provided……
查看>>
MySQL DBA 数据库优化策略
查看>>
multi_index_container
查看>>
MySQL DBA 进阶知识详解
查看>>
Mura CMS processAsyncObject SQL注入漏洞复现(CVE-2024-32640)
查看>>