jQuery学习-鼠标事件
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>鼠标事件</title>
<script src="js/jquery.js"></script> <style>
.me{ border: 1px solid red;
margin-top: 75px;
width: 400px;
height: 150px;
background-color: #ccc;
overflow: auto;
}
</style> <script type="text/javascript">
//页面加载完成简写形式
$(function(){
$("button").on("click",function(){ $("input").css("background-color","lightblue");
}); //移动进入的时候触发mouseover,移出时触发mouseout
//在jQuery中提供了个hover() 带两个参数 是 鼠标移动进入时执行的函数和鼠标移动出执行的函数
$(".me").hover(function(){
//移入执行的函数
$(this).css("background-color","red");
},function(){
//移出执行的函数
$(this).css("background-color","#ccc");
}) //给整个文档绑定鼠标移动事件
//在事件处理函数中有一个默认参数 事件对象event 它包含了事件产生的信息
$(document).on("mousemove",function(event){ var x=event.pageX//鼠标在文档X坐标
var y=event.pageY//鼠标Y坐标
$("#div1").text("X:"+x+"Y:"+y); }); //双击放大DIV
$(".me").on("dblclick",function(){ $(this).width();
$(this).height();
}); //停止双击事件向父层传播
$("button").dblclick(function(event){ event.stopPropagation();
}); }) </script>
</head>
<body>
<div>
<div id="div1">在这里显示坐标</div>
<div class="me">事件测试案例
<input type="text" /><br>
<button>提交</button>
</div>
</div>
</body>
</html>
jQuery学习-鼠标事件的更多相关文章
- jQuery的鼠标事件总结
jQuery的鼠标事件总结 1.click()事件. 2.dbclick()鼠标双击事件 3.mousedown()鼠标按下事件 4.mouseup()鼠标松开事件 5.mouseover()从一个元 ...
- js进阶 12-1 jquery的鼠标事件有哪些
js进阶 12-1 jquery的鼠标事件有哪些 一.总结 一句话总结:1+3*2+1+1,其中里面有两组移入移出,一组和click,总结就是click(3个),hover(5个),mousemove ...
- jquery学习笔记-----事件和动画
一.ready机制 $(document).ready( function(){} ) $().ready( function(){} ) $( function(){} ) jquery的read ...
- Python+Selenium学习--鼠标事件
场景 前景讲解了鼠标的click()事件,而我们在实际的web产品测试中,有关鼠标的操作,不仅仅只有单击,有时候还包括右击,双击,拖动等操作,这些操作包含在ActionChains类中. Action ...
- jQuery学习笔记——事件
何为事件 就是你的鼠标,键盘等对网页元素进行的操作. 常见事件 鼠标事件 键盘事件 表单事件 文档/窗口事件 click keypress submit load dblclick keydown c ...
- jquery 的鼠标事件/淡入淡出/绑定
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- jQuery学习三——事件
代码如下: <!DOCTYPE html> <html> <head> <title>jquery事件</title> </head& ...
- JQuery学习:事件绑定&入口函数&样式控制
1.基础语法学习: 1.事件绑定 2.入口函数 3.样式控制 <!DOCTYPE html> <html lang="en"> <head> & ...
- jQuery学习-键盘事件
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
随机推荐
- SQLSERVER:PREEMPTIVE_OS_GETPROCADDRESS等待类型的困惑
SQLSERVER:PREEMPTIVE_OS_GETPROCADDRESS等待类型的困惑 翻译自:http://troubleshootingsql.com/2011/07/20/preemptiv ...
- springMVC入门-03
接着上一讲介绍springMVC针对rest风格的支持. 查询数据 使用前:/user_show?id=120 使用后:/user/120 删除数据 使用前:/user_delete?id=123 使 ...
- 远程连接MySQL服务器
在CentOS虚拟机上安装好了MySQL服务以后,在windows上用Workbench客户端去连接时碰到很多问题,现在把解决过程记录一下. 1.在Windows上ping CentOS IP是可以p ...
- UNIX高级环境编程(9)进程控制(Process Control)- fork,vfork,僵尸进程,wait和waitpid
本章包含内容有: 创建新进程 程序执行(program execution) 进程终止(process termination) 进程的各种ID 1 进程标识符(Process Identifie ...
- Redis学习---Ubuntu下Redis的安装
Ubuntu系统安装 Linux 系统安装[Ubuntu] 安装/启动Redis 要在 Ubuntu 上安装 Redis,打开终端,然后输入以下命令: 升级软件管理模块apt: sudo apt-ge ...
- Linux FFmpeg(含x264、lame插件)安装记录
What is FFmpeg? FFmpeg是一套可以用来记录.转换数字音频.视频,并能将其转化为流的开源计算机程序.它提供了录制.转换以及流化音视频的完整解决方案. What is x264? H. ...
- Hadoop HBase概念学习系列之HBase里的HStore(十九)
Store在HBase里称为HStore.HStore包括MemStore和StoreFiles.
- 【接口】常见接口集合(返回JSON)
转<JSON校验网站…>http://www.bejson.com/go.html?u=http://www.bejson.com/webInterface.html 这里为大家搜集了一些 ...
- PHP设计模式系列 - 建造者模式
什么是建造者模式 建造者模式主要是为了消除其它对象复杂的创建过程. 设计场景 有一个用户的UserInfo类,创建这个类,需要创建用户的姓名,年龄,金钱等信息,才能获得用户具体的信息结果. 创建一个U ...
- BZOJ4802:欧拉函数(Pollard-Rho,欧拉函数)
Description 已知N,求phi(N) Input 正整数N.N<=10^18 Output 输出phi(N) Sample Input 8 Sample Output 4 Soluti ...