支持Chrome:

暂不支持浏览器:FF,IE...

希望后者努力

效果图:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZGFteXM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">

CSS:

<style type="text/css">
@-webkit-keyframes testAnim {
0% {-webkit-filter: grayscale(0.5) blur(1px) saturate(2);}
100% {-webkit-filter: grayscale(0.2) blur(6px) saturate(9);}
} /*IE,FF暂不支持*/
@-moz-keyframes testAnim {
0% {-moz-filter: grayscale(0.5) blur(1px) saturate(2);}
100% {-moz-filter: grayscale(0.2) blur(6px) saturate(9);}
} @-ms-keyframes testAnim {
0% {-ms-filter: grayscale(0.5) blur(1px) saturate(2);}
100% {-ms-filter: grayscale(0.2) blur(6px) saturate(9); }
} @keyframes testAnim {
0% {filter: grayscale(0.5) blur(1px) saturate(2);}
100% {filter: grayscale(0.2) blur(6px) saturate(9);}
} #animatePhoto {}
.animatePhoto:hover,#animatePhoto:hover{
-webkit-animation-name: testAnim;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: 1;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0s; /*IE,FF暂不支持*/
-moz-animation-name: testAnim;
-moz-animation-duration: 2s;
-moz-animation-iteration-count: 1;
-moz-animation-direction: alternate;
-moz-animation-timing-function: ease-out;
-moz-animation-fill-mode: forwards;
-moz-animation-delay: 0s; -ms-animation-name: testAnim;
-ms-animation-duration: 2s;
-ms-animation-iteration-count: 1;
-ms-animation-direction: alternate;
-ms-animation-timing-function: ease-out;
-ms-animation-fill-mode: forwards;
-ms-animation-delay: 0s; animation-name: testAnim;
animation-duration: 2s;
animation-iteration-count: 1;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 0s;
}
.l,.r{ width:40%; float:left; padding:40px;}
</style>

HTML:

<div class="l">
<h3>图片滤镜特效试验</h3>
<img id="fxPhoto" src="http://avatar.csdn.net/A/7/9/1_damys.jpg" />
<div id="sliderContainer"></div>
</div> <div class="r">
<h3>图片滤镜特效试验:hover</h3>
<img id="animatePhoto" class="animatePhoto" src="http://avatar.csdn.net/A/7/9/1_damys.jpg" />
</div>

JS:拖动效果

<script type="text/javascript">
var photo = jQuery("#fxPhoto");
var filters = [
{ name: "grayscale", cname: "黑白照片(灰度级)效果", def: "0", unit: "", min:0 , max:1.0, step: "0.01" },
{ name: "blur", cname: "模糊效果", def: "0", unit: "px", min: 0, max: 10 , step: "1"},
{ name: "sepia", cname: "老照片(褐黄色)效果", def: "0", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "saturate", cname: "饱和度调整", def: "1", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "opacity", cname: "透明度调整", def: "1", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "brightness", cname: "亮度调整", def: "1", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "contrast", cname: "对照度调整", def: "1", unit: "", min: 0, max: 1 , step: "0.01"},
{ name: "hue-rotate", cname: "色调调整", def: "0", unit: "deg", min: 0, max: 360 , step: "1"},
{ name: "invert", cname: "色彩反相", def: "0", unit: "", min: 0, max: 1.0 , step: "0.01"}
]; // Change event
function onChange() {
var cssString = ""; jQuery.each(filters, function() {
var value = jQuery('#'+this.name).val();
// Update the value title
jQuery('#title_'+this.name).html("<h3>" + this.cname + "(" + this.name + ":" +value + this.unit + ")</h3>"); // Update CSS string
cssString += " " + this.name + "(" + value + this.unit + ")";
});
photo.attr('style', "-webkit-filter: " + cssString);
} // For every filter
var container = jQuery("#sliderContainer");
jQuery.each(filters, function() {
container.append("<p id='title_"+this.name+"'>"+this.cname+"</p>");
container.append("<input onChange='onChange()' value='"+this.def+"' type='range' id='"+this.name+"' min='"+this.min+"' max='"+this.max+"' step='"+this.step+"'>");
}); onChange();
</script>

HTML5----CSS3图片滤镜(filter)特效的更多相关文章

  1. 基于HTML5/CSS3图片网格动画特效

    现在HTML5技术可以让网页上的图片变得非常神奇,各种各样的HTML5图片动画特效让你眼花缭乱.今天要分享的这款HTML5图片网格动画特效就非常炫酷.图片缩略图按网格的布局一行行排列,你只需点击按钮即 ...

  2. css3图片模糊过滤特效

    体验效果:点击这里查看效果 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...

  3. 精选 5 个漂亮的 CSS3 图片滑过特效

    这篇文章将为大家分享5款漂亮的CSS3图片滑过特效,比如滑过后显示图片的详细文字介绍,又比如滑过后对图片进行淡入淡出的效果等等.让我们一起来看看,喜欢的朋友赶紧收藏. 1.非常酷的CSS3图片说明效果 ...

  4. CSS3的滤镜filter属性

    css3的滤镜filter属性,可以对网页中的图片进行类似Photoshop图片处理的效果,例如背景的毛玻璃效果.老照片(黑白照片).火焰效果等. 一.blur(px)高斯模糊 二.brightnes ...

  5. 9款超绚丽的HTML5/CSS3应用和动画特效

    1.CSS3飘带状3D菜单 菜单带小图标 这次我们要来分享一款很特别的CSS3菜单,菜单的外观是飘带状的,并且每一个菜单项有一个精美的小图标,鼠标滑过菜单项时,菜单项就会向上凸起,像是飘带飘动一样,形 ...

  6. 基于CSS3图片悬停放大特效

    今天我们要来分享一款很酷的CSS3图片特效,这款图片特效可以利用鼠标滑过图片使其悬停放大,并使图片的周围出现发光的效果.配合黑色的背景,这款CSS3图片悬停放大效果显得更加立体大气,非常适合产品图片的 ...

  7. html5+css3图片旋转特效

    <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8" ...

  8. css3图片滤镜

    http://www.zhanxin.info/development/2012-12-19-css-filter.html

  9. HTML5/CSS3图片左右切换弹性动画

    在线演示 本地下载

随机推荐

  1. vsphere中的linux虚拟机安装vmware-tools

    先在vcenter中选中虚拟机点击安装这个工具,如图 然后这台linux虚拟机的控制台操作,挂载先建立挂载目录 cd /mnt #在挂载建一个用来挂载的文件. mkdir cdrom 使用mount命 ...

  2. MySQL系列(一)--数据类型

    如何选择优化的数据类型: 1.通常更小的更好 相同级别的数据类型,选择占据空间更小的数据类型.更小的数据类型通常更快,因为占用更少的磁盘.内存和CPU缓存,处理时需要的 CPU周期也更少,但是要确保需 ...

  3. 【原】常用shell命令

    #ss -ln  监听常用端口 #netstat -an |grep 80    80端口被占用情况 #linux 下使用 tc 模拟网络延迟和丢包

  4. Python 绑定方法与非绑定方法

    用到的: import uuid  --------------  uuid是128位的全局唯一标识符, 通常用32位的一个字符串的形式来表现 uuid.uuid1()  -------------  ...

  5. mysql解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的报错

    一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...

  6. 微信sdk 签名

    <?php namespace app\wechat\service; use think\Config; class Signature { protected $appId ; protec ...

  7. MySQL-----多对多

    多对多: 示例1: 用户表和相亲记录表 用户表 用户id 用户名                  性别 1 George  男 2 Elizabeth 女 3 Bruce 男 4 Catherine ...

  8. Django-rest_framework中利用jwt登录验证时,自定义返回凭证和登录校验支持手机号

    安装 pip install djangorestframework-jwt 在Django.settings中配置 REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATIO ...

  9. 集训第四周(高效算法设计)L题 (背包贪心)

    Description   John Doe is a famous DJ and, therefore, has the problem of optimizing the placement of ...

  10. UVA 227 周期串

    题意: 给一个字符串,寻找最短的循环节 如abcabcabcabc以3为周期,也按6和12为周期. 分析: 因为循环节肯定是相等的,所以枚举串长度的所有约数的循环节再判断是否相等即可. 我的方法是枚举 ...