diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 2b88fed1c..35baf4a77 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -165,11 +165,22 @@ $(".resourcesList").mousedown(function(e) { //将当前元素赋给 上一个对象 保存起来。 last_line = line; } -}); +}); + //元素包含关系计算 + var contains = function(root, el) { + if (root.compareDocumentPosition) + return root === el || !!(root.compareDocumentPosition(el) & 16); + if (root.contains && el.nodeType === 1){ + return root.contains(el) && root !== el; + } + while ((el = el.parentNode)) + if (el === root) return true; + return false; + } $(document.body).click(function(e) { //在列表上的任何单击事件都要恢复原来的样子 //隐藏右键菜单 - e.preventDefault() + //e.preventDefault(); $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} //如果当前行为空,那么要将当前行的拿到 @@ -181,9 +192,13 @@ $(document.body).click(function(e) { if(line.get(0).tagName === 'LI'){ line = line.parent(); } + } - //将当前行改变为白色 - line.children().css("background-color", 'white'); + //如果当前对象在表格里,将当前行改变为白色,这里主要是防止点击页面的其他链接的时候,那个链接背景色变白了 + if( contains($(".resourcesList").get(0),line.get(0))){ + line.children().css("background-color", 'white'); + } + //当前行恢复编辑状态到链接状态 if(ele && ele.nodeName != 'INPUT') { restore(); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 4e88ebf3f..4040971fd 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -385,8 +385,8 @@ a.sendButtonBlue:hover {color:#ffffff;} a.resourcesTypeAll {background:url(images/homepage_icon.png) -180px -89px no-repeat; padding-left:23px;} a.resourcesTypeAtt {background:url(images/homepage_icon.png) -180px -49px no-repeat; padding-left:23px;} .resourcesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-90px; font-size:12px; color:#888888; display:none; line-height:2;} -.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;} -.resourcesUploadBox:hover {background-color:#0781b4;} +/*.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}*/ +/*.resourcesUploadBox:hover {background-color:#0781b4;}*/ /* 个人主页右边部分*/ .homepageSearchIcon {width:30px; height:32px; background:url(images/nav_icon.png) -8px 3px no-repeat; float:left;} a.homepagePostTypeQuiz {background:url(images/homepage_icon.png) -90px -124px no-repeat; padding-left:23px;}