From 149ac07cf94bd63fe7bf55aa8e11aec5f4b81324 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 27 Aug 2015 16:20:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=87=8D=E5=A4=8D=E7=9A=84cs?= =?UTF-8?q?s=EF=BC=8C=20=E8=A7=A3=E5=86=B3=E4=B9=8B=E5=89=8D=E5=9C=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=85=B6=E4=BB=96=E5=9C=B0=E6=96=B9=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E9=93=BE=E6=8E=A5=EF=BC=8C=E5=AF=BC=E8=87=B4=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=83=8C=E6=99=AF=E8=89=B2=E5=8F=98=E7=99=BD=E8=89=B2?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_resource.html.erb | 23 +++++++++++++++++++---- public/stylesheets/new_user.css | 4 ++-- 2 files changed, 21 insertions(+), 6 deletions(-) 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(); } + + } + //如果当前对象在表格里,将当前行改变为白色,这里主要是防止点击页面的其他链接的时候,那个链接背景色变白了 + if( contains($(".resourcesList").get(0),line.get(0))){ + line.children().css("background-color", 'white'); } - //将当前行改变为白色 - 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;}