signup.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * 手机端报名弹窗JS
  3. * 调用的时候,只在需要的地方添加上 popup 类就可以了
  4. */
  5. $(function(){
  6. var bm_title,bm_hid,bm_text,bm_source; //为了这些变量在其它地方用;
  7. /*
  8. * 其它公共报名弹窗
  9. * */
  10. $('body .popup').on('click',function(){
  11. var urlstr = window.location.href;
  12. var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
  13. var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
  14. var $that = $(this);
  15. CreatePopLayerDiv('100%','100%','/public/signup');
  16. // 向弹窗传数据
  17. parent.bm_title=$that.attr('data-title');
  18. parent.bm_hid=$that.attr('data-hid');
  19. parent.bm_text=$that.attr('data-text');
  20. parent.bm_source=$that.attr('data-source');
  21. })
  22. /*
  23. * 底部看房定制弹窗
  24. * */
  25. $('.customize_btn').on('click',function(){
  26. var urlstr = window.location.href;
  27. var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
  28. var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
  29. var $that = $(this);
  30. var height = $('.m_form').outerHeight();
  31. var width = $('.m_form').outerWidth();
  32. CreatePopLayerDiv(width,width,matchdata+'/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. * 楼盘首页-项目分析
  42. * */
  43. $('.home_analyze a').on('click',function(){
  44. var urlstr = window.location.href;
  45. var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
  46. var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
  47. var $that = $(this);
  48. var height = $('.analyze').outerHeight();
  49. var width = $('.analyze').outerWidth();
  50. CreatePopLayerDiv(width,'auto',matchdata+'/public/analyze');
  51. // 向弹窗传数据
  52. parent.w_title = $that.attr('data-name'); //把楼盘名称传向父级
  53. parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级
  54. parent.w_module = $that.attr('data-module'); //模块ID
  55. })
  56. })
  57. $('.m_close').on('click',function(){
  58. $('.m_signUp_box').fadeOut(300);
  59. })
  60. $('.m_signUp').on('click',function(){
  61. $('.m_signUp_box').fadeOut(300);
  62. })
  63. //创建一个弹出层,width 宽度,height 高度,url
  64. function CreatePopLayerDiv(width,height,url){
  65. var Iheight=$(window).outerHeight();
  66. var Iwidth =$(window).outerWidth();
  67. var heights = height || 300;
  68. var widths = width || 500;
  69. var Oheight= (Iheight -heights) / 2;
  70. var Owidth = (Iwidth - widths) /2;
  71. var div ='<div id="InDiv" style="width:'+Iwidth+'px;height:'+Iheight+'px;position:fixed;z-index:10000;top:0;left:0;">';
  72. div+='<div id="Content"></div>';
  73. div+='</div>';
  74. $(document.body).append(div);
  75. if(url != ""){
  76. $("#Content").load(url);
  77. }
  78. }
  79. //移除弹出层
  80. function RemoveDiv(){
  81. $("#InDiv").remove();
  82. }
  83. function btnCloses(){
  84. RemoveDiv();
  85. }