1 Star 0 Fork 25

zy_laoyang/jquery_test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
show.html 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
zy_laoyang 提交于 2020-04-21 09:32 +08:00 . js面向对象
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/jquery.min.js"></script>
<script>
$(function(){
//i表示的是序号,n是元素
// $.each( [1,3,5], function(i, n){
// alert( "Item #" + i + ": " + n );
// });
$.each( { name: "John", lang: "JS" }, function(i, n){
alert( "Name: " + i + ", Value: " + n );
});
$("img").mousemove(function(eve){
$("#mes").html("当前 鼠标位置:offsetX:"+eve.offsetX +" ,offsetY:"+eve.offsetY);
var x=eve.offsetX*10-100;
var y=eve.offsetY*10-100;
$("#da").css("background","url('image/f3.jpg')"+x+"px "+y+"px");
} );
})
</script>
<style>
*{
margin: 0px auto;
}
div{
border: #000000 solid 1px;
display: inline-block;
}
#xiao{
width:100px;
height:100px;
}
#da{
width:200px;
height: 200px;
background : url("image/f3.jpg") 400px 400px;
}
</style>
</head>
<body>
<p id="mes"></p>
<div id="xiao"><img width="100px" src="image/f3.jpg" alt="花"></div>
<div id="da">&nbsp;</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/zy_laoyang/jquery_test.git
[email protected]:zy_laoyang/jquery_test.git
zy_laoyang
jquery_test
jquery_test
master

搜索帮助