signup.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. console.log(searchurl)
  14. // var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
  15. var $that = $(this);
  16. CreatePopLayerDiv('100%','100%','/public/signup');
  17. // 向弹窗传数据
  18. parent.bm_title=$that.attr('data-title');
  19. parent.bm_hid=$that.attr('data-hid');
  20. parent.bm_text=$that.attr('data-text');
  21. parent.bm_source=$that.attr('data-source');
  22. })
  23. /*
  24. * 底部看房定制弹窗
  25. * */
  26. $('.customize_btn').on('click',function(){
  27. var urlstr = window.location.href;
  28. var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
  29. // var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
  30. var $that = $(this);
  31. var height = $('.m_form').outerHeight();
  32. var width = $('.m_form').outerWidth();
  33. CreatePopLayerDiv(width,width,'/public/customization');
  34. $('.m_signUp_box').show();
  35. $('.m_form').css('margin-top',-height/2 -20);
  36. // 向弹窗传数据
  37. parent.w_title = $that.attr('data-name'); //把楼盘名称传向父级
  38. parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级
  39. parent.w_module = $that.attr('data-module'); //模块ID
  40. })
  41. /*
  42. * 楼盘首页-项目分析
  43. * */
  44. $('.home_analyze a').on('click',function(){
  45. var urlstr = window.location.href;
  46. var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
  47. // var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
  48. var $that = $(this);
  49. var height = $('.analyze').outerHeight();
  50. var width = $('.analyze').outerWidth();
  51. CreatePopLayerDiv(width,'auto','/public/analyze');
  52. // 向弹窗传数据
  53. parent.w_title = $that.attr('data-name'); //把楼盘名称传向父级
  54. parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级
  55. parent.w_module = $that.attr('data-module'); //模块ID
  56. })
  57. })
  58. $('.m_close').on('click',function(){
  59. $('.m_signUp_box').fadeOut(300);
  60. })
  61. $('.m_signUp').on('click',function(){
  62. $('.m_signUp_box').fadeOut(300);
  63. })
  64. //创建一个弹出层,width 宽度,height 高度,url
  65. function CreatePopLayerDiv(width,height,url){
  66. var Iheight=$(window).outerHeight();
  67. var Iwidth =$(window).outerWidth();
  68. var heights = height || 300;
  69. var widths = width || 500;
  70. var Oheight= (Iheight -heights) / 2;
  71. var Owidth = (Iwidth - widths) /2;
  72. var div ='<div id="InDiv" style="width:'+Iwidth+'px;height:'+Iheight+'px;position:fixed;z-index:10000;top:0;left:0;">';
  73. div+='<div id="Content"></div>';
  74. div+='</div>';
  75. $(document.body).append(div);
  76. if(url != ""){
  77. $("#Content").load(url);
  78. }
  79. }
  80. //移除弹出层
  81. function RemoveDiv(){
  82. $("#InDiv").remove();
  83. }
  84. function btnCloses(){
  85. RemoveDiv();
  86. }