admin管理员组文章数量:1026373
How do i make the image darken, then overlay a png image like here?
here's my current code:
<!DOCTYPE html>
<html>
<head>
<title>JQuery Effect</title>
<script type='text/javascript' src='.5/jquery.min.js?ver=3.2'></script>
</head>
<body>
<img src=".jpg"/>
</body>
</html>
How do i make the image darken, then overlay a png image like here?
here's my current code:
<!DOCTYPE html>
<html>
<head>
<title>JQuery Effect</title>
<script type='text/javascript' src='http://ajax.googleapis./ajax/libs/jquery/1.5/jquery.min.js?ver=3.2'></script>
</head>
<body>
<img src="http://i25.lulzimg./7cd053.jpg"/>
</body>
</html>
Share
Improve this question
edited Aug 23, 2011 at 9:07
Goliath
asked Aug 23, 2011 at 9:01
GoliathGoliath
231 silver badge4 bronze badges
1
- 2 It might be easier to help if you show what you've tried so far? – slapthelownote Commented Aug 23, 2011 at 9:04
2 Answers
Reset to default 4Put a black background-color on the image container and fade out the image on hover.
The jquery (for example) would look something like this:
$('.fadable-image').each(function(){
$(this).hover(function(){
$(this).animate({opacity: 0.5}, 250, 'swing');
},function(){
$(this).animate({opacity: 1}, 250, 'swing');
});
});
http://api.jquery./animate/
http://api.jquery./hover/
Could also be done with CSS pseudo classes, but then without effects.
I've taken the code straight out of the site for you to see how it's done. The + image doesn't show up as the path to the img file is unknown to me.
See here.
How do i make the image darken, then overlay a png image like here?
here's my current code:
<!DOCTYPE html>
<html>
<head>
<title>JQuery Effect</title>
<script type='text/javascript' src='.5/jquery.min.js?ver=3.2'></script>
</head>
<body>
<img src=".jpg"/>
</body>
</html>
How do i make the image darken, then overlay a png image like here?
here's my current code:
<!DOCTYPE html>
<html>
<head>
<title>JQuery Effect</title>
<script type='text/javascript' src='http://ajax.googleapis./ajax/libs/jquery/1.5/jquery.min.js?ver=3.2'></script>
</head>
<body>
<img src="http://i25.lulzimg./7cd053.jpg"/>
</body>
</html>
Share
Improve this question
edited Aug 23, 2011 at 9:07
Goliath
asked Aug 23, 2011 at 9:01
GoliathGoliath
231 silver badge4 bronze badges
1
- 2 It might be easier to help if you show what you've tried so far? – slapthelownote Commented Aug 23, 2011 at 9:04
2 Answers
Reset to default 4Put a black background-color on the image container and fade out the image on hover.
The jquery (for example) would look something like this:
$('.fadable-image').each(function(){
$(this).hover(function(){
$(this).animate({opacity: 0.5}, 250, 'swing');
},function(){
$(this).animate({opacity: 1}, 250, 'swing');
});
});
http://api.jquery./animate/
http://api.jquery./hover/
Could also be done with CSS pseudo classes, but then without effects.
I've taken the code straight out of the site for you to see how it's done. The + image doesn't show up as the path to the img file is unknown to me.
See here.
本文标签: javascriptOverlay png image and darken image on hoverStack Overflow
版权声明:本文标题:javascript - Overlay png image and darken image on hover - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745641719a2160786.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论