From 10eeeaa95cbe937457879a7fe1a8e96469b739f7 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Feb 2016 23:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/search_user_course.js.erb | 14 ++++++++------ app/views/users/search_user_org.js.erb | 11 ++++++++++- app/views/users/search_user_project.js.erb | 11 ++++++++++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index eed7499d5..a5559a610 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -1,8 +1,10 @@ -//var screenWidth = $(window).width(); -//var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 -//var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 -//var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改 -//var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 +var screenWidth = $(window).width(); +var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 +var boxWidth = 452; + +var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 +var objLeft = (screenWidth - boxWidth)/2 ; //2 可以根据需要修改 +var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 //var popupHeight = $(".resourceSharePopup").outerHeight(true); //$(".resourceSharePopup").css("marginTop",-popupHeight/2); // @@ -19,7 +21,7 @@ showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","415px").css("left","1045px"); +$('#ajax-modal').parent().css("top",objTop+"px").css("left", objLeft+200+ "px"); $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); var val = $("#search_course_input").val(); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index 877629e34..382b243ea 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -5,10 +5,19 @@ <% elsif params[:send_type] == 'message' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); <% end %> + +var screenWidth = $(window).width(); +var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 +var boxWidth = 452; + +var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 +var objLeft = (screenWidth - boxWidth)/2 ; //2 可以根据需要修改 +var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 + showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","415px").css("left","1045px"); +$('#ajax-modal').parent().css("top",objTop+"px").css("left",objLeft+200+"px"); $('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); var val = $("#search_org_input").val(); diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index f80be34f8..17e0ed918 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -5,10 +5,19 @@ <% elsif params[:send_type] == 'message' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% end %> + +var screenWidth = $(window).width(); +var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 +var boxWidth = 452; + +var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 +var objLeft = (screenWidth - boxWidth)/2 ; //2 可以根据需要修改 +var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 + showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","415px").css("left","1045px"); +$('#ajax-modal').parent().css("top",objTop+"px").css("left",objLeft+200+"px"); $('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); //$("#search_project_input").focus();