<div class="group_list">
<div class="all_friend" v="1">
<span class="qbhy" v="1">全部好友</span>
<span class="hysl" v="1">(123)</span>
</div>
</div>
.all_friend{float:left; width:160px; height:25px;margin-top:11px; display:inline}
.qbhy{float:left; width:auto; height:12px; line-height:12px; margin-top:6px; display:inline; margin-left:15px}
.hysl{float:left; width:auto; height:12px; line-height:12px; margin-left:2px; color:#74a18c;margin-top:6px;}
.fri_cur{ background:#e6d9c6; cursor:pointer; }
//分组过度效果
$('.all_friend').mouseover(function(){
var str="";
$(this).addClass('fri_cur')
var p=$(this).attr('v');
str+="<span class=\"ccd\" v="+p+">333</span>"
$('.hysl[v='+p+']').after(str);
console.log("222")
})
$('.all_friend').mouseout(function(){
var p=$(this).attr('v');
$('.all_friend[v='+p+']').removeClass('fri_cur');
$('.ccd[v='+p+']').remove();
console.log("23332")
})
为什么鼠标移动到新增的<span class=\"ccd\" v="+p+">333</span>会出发mouseout事件
解决方案 »
- 怎么使getElementsByTagName能获取iframe中的控件
- ajax高手来帮帮忙
- 超链接如何使跳转后再无效
- 怎么用js限制输出的字符个数
- innerHTML赋值丢失对象
- 如何允许编辑select控件?
- jQuery easyui的datagrid里的插入行insertRow怎么用?
- 大虾们看起来可能很简单问题,我自己写的javascript代码,不知道哪出错了?挺短的,请来看看,多谢!
- 急。net中鼠标悬停在一级菜单显示二级菜单但是二级菜单不能显示 求解决
- 为什么js特效放大镜的坐标不一致?帮我分析一下。谢谢
- 求一段可以隐藏网页左下角状态栏信息的代码
- 求JS高手,把下面的JS改成兼容IE,火狐和Goolge浏览器
参考下
http://www.w3school.com.cn/jquery/event_mouseleave.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var mouseX;
var mouseY;
$(document).bind("contextmenu", function (e) { //去掉默认右键功能
return false;
});
$(document).mousedown(function (e) {
mouseX = e.clientX;
mouseY = e.clientY;
if (3 == e.which) { //右键单击
$("#area").css('margin-left', mouseX);
$("#area").css('margin-top', mouseY);
$("#area").show();
} else if (1 == e.which && !($('#area').find(e.target).length != 0 || $('#area')[0] == $(e.target)[0])) { //左键单击
$("#area").hide();
}
return
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="area" style="width:150px; height:200px; background-color:red; display:none;" >
<input type="button" value="我是按钮" onmousedown="alert('11');" />
</div>
</div>
</form>
</body>
</html>
你是想说鼠标右键功能吧