signup.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * 手机端报名弹窗JS
  3. * 调用的时候,只在需要的地方添加上 popup 类就可以了
  4. */
  5. $(function(){
  6. var w_title,w_id,w_url,w_text; //为了这些变量在其它地方用;
  7. /*
  8. * 其它公共报名弹窗
  9. * */
  10. $('body').on('click','.popup',function(){
  11. var $that = $(this);
  12. var height = $('.m_form').outerHeight();
  13. var width = $('.m_form').outerWidth();
  14. CreatePopLayerDiv(width,width,'/public/signup');
  15. $('.m_signUp_box').show();
  16. $('.m_form').css('margin-top',-height/2 -20);
  17. // 向弹窗传数据
  18. parent.w_title = $that.attr('data-name'); //把楼盘名称传向父级
  19. parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级
  20. parent.w_module = $that.attr('data-module'); //模块ID
  21. parent.w_text = $that.attr('data-text'); //窗口文本内容
  22. parent.w_button = $that.attr('data-button'); //窗口文本内容
  23. shanwutong(); //修改商务通层级 /js/nav.js
  24. })
  25. /*
  26. * 底部看房定制弹窗
  27. * */
  28. $('.customize_btn').on('click',function(){
  29. var $that = $(this);
  30. var height = $('.m_form').outerHeight();
  31. var width = $('.m_form').outerWidth();
  32. CreatePopLayerDiv(width,width,'/public/customization');
  33. $('.m_signUp_box').show();
  34. $('.m_form').css('margin-top',-height/2 -20);
  35. // 向弹窗传数据
  36. parent.w_title = $that.attr('data-name'); //把楼盘名称传向父级
  37. parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级
  38. parent.w_module = $that.attr('data-module'); //模块ID
  39. })
  40. })
  41. $('.m_close').on('click',function(){
  42. $('.m_signUp_box').fadeOut(300);
  43. })
  44. $('.m_signUp').on('click',function(){
  45. $('.m_signUp_box').fadeOut(300);
  46. })
  47. //创建一个弹出层,width 宽度,height 高度,url
  48. function CreatePopLayerDiv(width,height,url){
  49. var Iheight=$(window).outerHeight();
  50. var Iwidth =$(window).outerWidth();
  51. var heights = height || 300;
  52. var widths = width || 500;
  53. var Oheight= (Iheight -heights) / 2;
  54. var Owidth = (Iwidth - widths) /2;
  55. var div ='<div id="InDiv" style="width:'+Iwidth+'px;height:'+Iheight+'px;background:rgba(0,0,0,0.6);position:fixed;z-index:10000;top:0;left:0;">';
  56. div+='<div id="Content"></div>';
  57. div+='</div>';
  58. $(document.body).append(div);
  59. if(url != ""){
  60. $("#Content").load(url);
  61. }
  62. }
  63. //移除弹出层
  64. function RemoveDiv(){
  65. $("#InDiv").remove();
  66. }
  67. function btnCloses(){
  68. RemoveDiv();
  69. }