/* * 手机端报名弹窗JS * 调用的时候,只在需要的地方添加上 popup 类就可以了 */ $(function(){ var w_title,w_id,w_text,w_module; //为了这些变量在其它地方用; /* * 其它公共报名弹窗 * */ $('.appleBm_popup').on('click',function(){ var $that = $(this); CreatePopLayerDiv(300,400,'/public/signup'); $('.m_signUp_box').show(); // 向弹窗传数据 parent.w_title = $that.attr('data-title'); //把楼盘名称传向父级 parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级 parent.w_module = $that.attr('data-module'); //模块ID parent.w_text = $that.attr('data-text'); //窗口文本内容 }) /* * 新公共报名弹窗 小明 * */ $('.m_appleBm_popup').on('click',function(){ var $that = $(this); CreatePopLayerDiv(300,400,'/public/signupv2'); $('.m_signUp_box').show(); // 向弹窗传数据 parent.w_title = $that.attr('data-title'); //把楼盘名称传向父级 parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级 parent.w_module = $that.attr('data-module'); //模块ID parent.w_text = $that.attr('data-text'); //窗口文本内容 parent.w_button = $that.attr('data-button'); }) /* * 新公共报名弹窗 小明 * */ $('.xm_appleBm_popup').on('click',function(){ var $that = $(this); CreatePopLayerDiv(300,400,'/public/signupv3'); $('.m_signUp_box').show(); // 向弹窗传数据 parent.w_title = $that.attr('data-title'); //把楼盘名称传向父级 parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级 parent.w_module = $that.attr('data-module'); //模块ID parent.w_text = $that.attr('data-text'); //窗口文本内容 }) /* * 底部看房定制弹窗 * */ $('.customize_btn').on('click',function(){ var $that = $(this); var height = $('.m_form').outerHeight(); var width = $('.m_form').outerWidth(); CreatePopLayerDiv(width,width,'/public/customization'); $('.m_signUp_box').show(); $('.m_form').css('margin-top',-height/2 -20); // 向弹窗传数据 parent.w_title = $that.attr('data-name'); //把楼盘名称传向父级 parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级 parent.w_module = $that.attr('data-module'); //模块ID }) }) //创建一个弹出层,width 宽度,height 高度,url function CreatePopLayerDiv(width,height,url){ var Iheight=$(window).outerHeight(); var Iwidth =$(window).outerWidth(); var heights = height || 300; var widths = width || 500; var Oheight= (Iheight -heights) / 2; var Owidth = (Iwidth - widths) /2; var div ='
'; div+='
'; div+='
'; $(document.body).append(div); if(url != ""){ $("#Content").load(url); } } //移除弹出层 function RemoveDiv(){ $("#InDiv").remove(); }