资源库鼠标在移动时,灰色条跟着动

This commit is contained in:
ouyangxuhua 2015-11-02 14:20:14 +08:00
parent 4dcbe18027
commit 1a7e1db3fb
1 changed files with 23 additions and 0 deletions

View File

@ -145,6 +145,7 @@
var id; //资源id
var sendType; //发送到课程 1 发送到项目 2
var lastSendType; //保存上次发送的发送类型
var last_op
$("#resources_list").mousedown(function(e) {
//如果是右键的话
if (3 == e.which) {
@ -179,6 +180,28 @@
last_line = line;
}
});
//鼠标经过时,背景颜色设为灰色
$("#resources_list").mouseover(function(e){
pageX = e.clientX;
pageY = e.clientY;
var ele = document.elementFromPoint(pageX,pageY);
line = $(ele).parent();
if(last_op != null){
last_op.children().css("background-color", 'white');
restore();
last_op == null;
}
//如果当前的tag是li那么还要li的父级元素
if(line.get(0).tagName === 'LI'){
line = line.parent();
}
//将当前的元素的所有子元素的背景色改为蓝色
line.children().css("background-color", '#e1e1e1');
//将当前元素赋给 上一个对象 保存起来。
last_op = line;
});
//元素包含关系计算
var contains = function(root, el) {
if (root.compareDocumentPosition)