jq实现鼠标经过图片翻滚效果
短短的十多行代码就实现了一个酷炫的图片翻滚代码,要实现这个效果并不难,只要思路对了,一切都好办,不多说了,直接上代码看效果!
html结构:
<ul class="list">
<li><img src="data:images/10.jpg" alt="" /><a href="#"><span>1</span></a></li>
<li><img src="data:images/11.jpg" alt="" /><a href="#"><span>2</span></a></li>
<li><img src="data:images/12.jpg" alt="" /><a href="#"><span>3</span></a></li>
<li><img src="data:images/13.jpg" alt="" /><a href="#"><span>4</span></a></li>
<li><img src="data:images/10.jpg" alt="" /><a href="#"><span>5</span></a></li>
<li><img src="data:images/11.jpg" alt="" /><a href="#"><span>6</span></a></li>
<li><img src="data:images/12.jpg" alt="" /><a href="#"><span>7</span></a></li>
<li><img src="data:images/13.jpg" alt="" /><a href="#"><span>8</span></a></li> </ul>
css代码:
*{ margin:; padding:;}
.list{ width:640px; margin:100px auto; border:1px solid #ddd; overflow:hidden;}
.list li{ float:left; width:150px; height:80px; overflow:hidden; list-style:none; margin:5px; display:inline; position:relative;}
.list li img{ float:left; width:150px; height:80px; border:none;}
.list li a{ position:absolute; left:; top:; width:150px; height:; background:#999; margin-top:40px; display:inline; text-align:center; line-height:80px; overflow:hidden; color:#fff; text-decoration:none;}
jq代码(注意要引入jq库):
$(function () {
$('.list li').hover(function () {
$(this).children('a,img').stop();
$(this).children('img').stop().animate({ 'marginTop': 40, 'height': 0 }, 200, function () {
$(this).siblings('a').stop().animate({ 'height': 80, 'marginTop': 0 }, 200);
});
}, function () {
$(this).children('a,img').stop();
$(this).children('a').stop().animate({ 'height': 0, 'marginTop': 40 }, 200, function () {
$(this).siblings('img').stop().animate({ 'marginTop': 0, 'height': 80 }, 200);
});
});
});
是不是很简单的几句jq代码?亲,不妨copy下来看下效果呗!
jq实现鼠标经过图片翻滚效果的更多相关文章
- jQuery实现鼠标经过图片变亮效果
在线体验效果:http://hovertree.com/texiao/jquery/1.htm 以下是完整源代码: <!DOCTYPE html PUBLIC "-//W3C//DTD ...
- 浅谈CSS和JQuery实现鼠标悬浮图片放大效果
对于刚刚学习网页前台设计的同学一定对图片的处理非常苦恼,那么这里简单的讲解一下几个图片处理的实例. 以.net为平台,微软的Visual Studio 2013为开发工具,当然前台技术还是采用CSS3 ...
- jquery图片放大插件鼠标悬停图片放大效果
都知道jquery都插件是非常强大的,最近分享点jquery插件效果,方便效果开发使用. 一.HTML代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHT ...
- CSS技巧!鼠标经过图片抖动效果
把代码加到style.css(模板的主css里面): /**图片抖动**/ img:hover{-webkit-animation: tada 1s .2s ease both;-moz-animat ...
- css3鼠标悬停图片抖动效果
提供一个参考的链接 http://demo.lanrenzhijia.com/2015/pic0113/
- 头条PC端的鼠标经过图片放大效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- css3鼠标移动图片上移效果
css3的功能真是很强大,学无止境,不多说,直接上代码 css部分: <style> ;;} .text-center{text-align:center} .col_cont{width ...
- js鼠标滚轮滚动图片切换效果
效果体验网址:http://keleyi.com/keleyi/phtml/image/12.htm HTML文件代码: <!DOCTYPE html PUBLIC "-//W3C// ...
- [读码][js,css3]能感知鼠标方向的图片遮罩效果
效果图: 无意间看到过去流行的一个效果:[能感知鼠标方向的图片遮罩效果]近来不忙,就仔细的看了一看看到后来发现,网上有好多版本,谁是原著者似乎已经无法考证.读码就要读比较全面的,读像是原著的代码.代码 ...
随机推荐
- U盘安装CentOS7
1:U盘启动,进入安装界面,点击Tab键,修改最后一行如下: ...=initrd.img linux dd quiet 查看centos系统盘符,例如:sdb4 2:重启电脑,进入安装界面,点击Ta ...
- Android添加桌面快捷方式的简单实现
核心代码如下: Button bn = (Button) findViewById(R.id.bn); // 为按钮的单击事件添加监听器 bn.setOnClickListener(new OnCli ...
- Cracking the coding interview--Q2.3
Implement an algorithm to delete a node in the middle of a singly linked list,given only access to t ...
- ASP.NET状缓存Cache的应用-提高数据库读取速度
原文:ASP.NET状缓存Cache的应用-提高数据库读取速度 一. Cache概述 既然缓存中的数据其实是来自数据库的,那么缓存中的数据如何和数据库进行同步呢?一般来说,缓存中应该存放改 ...
- C++ 常用的字符串处理函数实现
以下是一些标准库没有实现的函数,我觉得很方便就写了,估计会不定时更新. //根据一个文件的路径获取文件名 std::string file_name(const std::string& pa ...
- perl 正则前导字符
uat-prx02:/root# cat a1.pl my $str="123"; if ($str =~/(abc)*/){print "111111111\n&quo ...
- 【转】掌握java枚举类型(enum type)
原文网址:http://iaiai.iteye.com/blog/1843553 1 背景 在java语言中还没有引入枚举类型之前,表示枚举类型的常用模式是声明一组具有int常量.之前我们通常利用 ...
- MFC对话框应用程序添加自定义消息
1. 定义自定义消息 /** * \brief 消息测试 */ #define E6100_MSG_TEST ( WM_USER + 1001 ) 2. 声明自定义消息处理函数 /* ...
- 使用read(),write(),seekg(),seekp()实现二进制方式文件随机存取
// binary.cpp -- binary file I/O #include <iostream> #include <fstream> #include <iom ...
- Linux下aMule安装教程
Linux下载神器aMule安装教程 aMule可以说是Linux下的电驴,你们说eMule是不是就是aMule的Windows版呢?也是开源的. Fedora安装aMule很简单,两条命令就搞定. ...