首页 > 语言 > JavaScript > 正文

js模仿hover的具体实现代码

2024-05-06 15:58:05
字体:
来源:转载
供稿:网友
hover效果,想必大家并不陌生吧,接下来为大家介绍下使用js模仿hover,感兴趣的朋友可以参考下

复制代码 代码如下:


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta content="this" />
<meta content="this" />
<title>this</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<style type="text/css">
body{margin:0;padding:0;}
.hover{float:left;position:relative;margin:0 auto;padding:0; }
.hv{position:absolute; left:0;top:0;display:none; }
</style>
<script type="text/javascript">
$(function() {
$('.hover').hover(
function (){
$('.hv').stop().fadeTo('slow',1);
},function() {
$('.hv').stop().fadeTo('slow',0);
}
)
})
</script>
</head>

<body>
<div>
<img src="http://www.vevb.com/uploads/allimg/131231/10593c506_1.jpg" >
<img src="http://www.vevb.com/uploads/allimg/131231/10593c506_0.gif" >
</div>
</body>
</html>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选