목차
回复讨论(解决方案)
백엔드 개발 PHP 튜토리얼 请教高手帮助解决一个问题!

请教高手帮助解决一个问题!

Jun 23, 2016 pm 01:52 PM
해결하다 주인

这段代码是个弹出框,但是弹出后居于页面的上下左右居中,请问如何定位这个弹出框?比如距离顶部100像素。 

function ShowIframe(title,url,w,h)
 {
        var pop=new Popup({ contentType:1,scrollType:'no',isReloadOnClose:false,width:w,height:h});
        pop.setContent("contentUrl",url);
        pop.setContent("title",title);
    
        pop.build();
        pop.show();
         }



 上传图片



回复讨论(解决方案)

popup是什么 看样子是某种js插件?
如果是,百度一下应该有使用方法文档的

popup是什么 看样子是某种js插件?
如果是,百度一下应该有使用方法文档的



搜过了,没有找到解决的办法

贴出 Popup 的定义

///******************* popup.js********************/
///修正ie5、ie6、ie7、firefox3.0 兼容问题
///************************************************/
if(!Array.prototype.push){Array.prototype.push=function(){var startLength=this.length;for(var j=0;j';var cB='filter: alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';';var cover='

接上楼

style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:'+baseZIndex+';'+cB+'background-color:'+this.color.cColor+';display:none;">

';var mainBox='
';if(this.config.isHaveTitle){mainBox+=''}else{mainBox+=''};mainBox+='
'+''+'
'+this.info.title+' '+close+'
'+close+'
'+'
';if(!this.config.isBackgroundCanClick){G('dialogCase').innerHTML=cover+mainBox;this.setBackgroundSize();window.onresize=this.setBackgroundSize;}else{G('dialogCase').innerHTML=mainBox;}Event.observe(G('dialogBoxClose'),"click",this.reset.bindAsEventListener(this),false);if(this.config.isSupportDraging){dropClass=new Dragdrop(this.config.width,this.config.height,this.info.shadowWidth,this.config.isSupportDraging,this.config.contentType);G("dialogBoxTitle").style.cursor="move"};this.lastBuild()},setBackgroundSize:function(){var getValueWidth;var getMaxValueWidth=[getValue("clientWidth"),getValue("scrollWidth")];getValueWidth=eval("Math.max("+getMaxValueWidth.toString()+")");G('dialogBoxBG').style.width=getValueWidth;var getValueHeight;var getMaxValueHeight=[getValue("clientHeight"),getValue("scrollHeight")];getValueHeight=eval("Math.max("+getMaxValueHeight.toString()+")");G('dialogBoxBG').style.height=getValueHeight;},lastBuild:function(){var confirm='
'+this.info.confirmCon+'
 
';var alert='
'+this.info.alertCon+'
';var baseZIndex=10001+this.info.overlay*10;var coverIfZIndex=baseZIndex+4;if(this.config.contentType==1){var openIframe="";var coverIframe="
";G("dialogBody").innerHTML=openIframe+coverIframe;}else if(this.config.contentType==2){G("dialogBody").innerHTML=this.info.contentHtml;}else if(this.config.contentType==3){G("dialogBody").innerHTML=confirm;Event.observe(G('dialogOk'),"click",this.forCallback.bindAsEventListener(this),false);Event.observe(G('dialogCancel'),"click",this.close.bindAsEventListener(this),false);}else if(this.config.contentType==4){G("dialogBody").innerHTML=alert;Event.observe(G('dialogYES'),"click",this.close.bindAsEventListener(this),false);};},reBuild:function(){G('dialogBody').height=G('dialogBody').clientHeight;this.lastBuild()},show:function(){this.hiddenSome();this.middle();if(this.config.isShowShadow)this.shadow()},forCallback:function(){return this.info.callBack(this.info.parameter)},shadow:function(){var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow['style']['position']="absolute";oShadow['style']['background']="#000";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['top']=oDialog.offsetTop+this.info.shadowWidth+"px";oShadow['style']['left']=oDialog.offsetLeft+this.info.shadowWidth+"px";oShadow['style']['width']=oDialog.offsetWidth+"px";oShadow['style']['height']=oDialog.offsetHeight+"px";},middle:function(){if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='';var oDialog=G('dialogBox');oDialog['style']['position']="absolute";oDialog['style']['display']='';var sClientWidth=getValue("clientWidth");var sClientHeight=getValue("clientHeight");var sScrollTop=getValue("scrollTop");var sleft=(sClientWidth/2)-(oDialog.offsetWidth/2);var iTop=(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);var sTop=iTop>0?iTop:(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);if(sTop

接上楼

parseInt(this.oObj.style.top)+25)iTop=iTop+12;this.oObj.style.left=iLeft+"px";this.oObj.style.top=iTop+"px";;if(this.showShadow){G('dialogBoxShadow').style.left=iLeft+this.shadowWidth+"px";G('dialogBoxShadow').style.top=iTop+this.shadowWidth+"px";};this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};document.body.style.cursor="move";},mouseup:function(event){if(!this.IsDraging)return;if(this.contentType==1)G("iframeBG").style.display="none";document.onmousemove=null;document.onmouseup=null;var mousX=Event.pointerX(event)-(document.documentElement.scrollLeft||document.body.scrollLeft);var mousY=Event.pointerY(event)-(document.documentElement.scrollTop||document.body.scrollTop);var oObjBottom;var oObjRight;if(this.showShadow){oObjBottom=parseInt(this.oObj.style.top)+this.height+this.shadowWidth;oObjRight=parseInt(this.oObj.style.left)+this.width+this.shadowWidth;}else{oObjBottom=parseInt(this.oObj.style.top)+this.height;oObjRight=parseInt(this.oObj.style.left)+this.width;};if(mousXdocument.body.clientWidth||mousY>document.body.clientHeight||parseInt(this.oObj.style.left)document.body.clientWidth||oObjBottom>document.body.clientHeight){this.oObj.style.left=this.backData["x"];this.oObj.style.top=this.backData["y"];if(this.showShadow){G('dialogBoxShadow').style.left=this.backData.x+this.shadowWidth;G('dialogBoxShadow').style.top=this.backData.y+this.shadowWidth;};};this.IsDraging=false;document.body.style.cursor="";Event.stopObserving(document,"selectstart",this.returnFalse,false);},returnFalse:function(){return false;}};function openshow(url,title,w,h,stype){g_pop=new Popup({contentType:stype,isReloadOnClose:false,width:w,height:h});g_pop.setContent("title",title);g_pop.setContent("contentUrl",url);g_pop.build();g_pop.show();}function g_close_pop_re(){g_pop.close();location.reload();}function Comment(url,w,h){g_pop=new Popup({contentType:1,isReloadOnClose:false,width:w,height:h});g_pop.setContent("title","登陆");g_pop.setContent("scrollType","no");g_pop.setContent("contentUrl",url);g_pop.build();g_pop.show();}function g_close_pop(){g_pop.close();g_pop=null;}function ShowAlert(title,content,w,h){var pop=new Popup({contentType:4,isReloadOnClose:false,width:w,height:h});pop.setContent("title",title);pop.setContent("alertCon",content);pop.build();pop.show();}function Wclose(){g_pop.close();g_pop=null;}

直接用Chrome等浏览器的开发者工具来查看Popup生成的HTML,然后直接定义相应的CSS样式就行了。

直接用Chrome等浏览器的开发者工具来查看Popup生成的HTML,然后直接定义相应的CSS样式就行了。


当然,这是暴力方法,但绝对有效。可能Popup插件本身就有定位的方法,但是懒得去研究查找。

那么多Popup插件,没文档不知道换一个插件么?

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Steam 오류 코드 118 수정하는 방법 Steam 오류 코드 118 수정하는 방법 Feb 19, 2024 pm 05:56 PM

Steam 오류 코드 118 수정하는 방법

Win11 시스템에서 중국어 언어 팩을 설치할 수 없는 문제에 대한 해결 방법 Win11 시스템에서 중국어 언어 팩을 설치할 수 없는 문제에 대한 해결 방법 Mar 09, 2024 am 09:48 AM

Win11 시스템에서 중국어 언어 팩을 설치할 수 없는 문제에 대한 해결 방법

스팀 오류 코드 E20 해결 방법 스팀 오류 코드 E20 해결 방법 Feb 19, 2024 pm 09:17 PM

스팀 오류 코드 E20 해결 방법

Black Shark 휴대폰이 켜지지 않는 문제를 해결하는 방법을 알려주는 5가지 팁! Black Shark 휴대폰이 켜지지 않는 문제를 해결하는 방법을 알려주는 5가지 팁! Mar 24, 2024 pm 12:27 PM

Black Shark 휴대폰이 켜지지 않는 문제를 해결하는 방법을 알려주는 5가지 팁!

Xiaohongshu에 게시할 때 사진이 자동으로 저장되는 문제를 해결하는 방법은 무엇입니까? 포스팅 시 자동으로 저장되는 이미지는 어디에 있나요? Xiaohongshu에 게시할 때 사진이 자동으로 저장되는 문제를 해결하는 방법은 무엇입니까? 포스팅 시 자동으로 저장되는 이미지는 어디에 있나요? Mar 22, 2024 am 08:06 AM

Xiaohongshu에 게시할 때 사진이 자동으로 저장되는 문제를 해결하는 방법은 무엇입니까? 포스팅 시 자동으로 저장되는 이미지는 어디에 있나요?

이 장치에 드라이버를 로드할 수 없습니다. 어떻게 해결합니까? (개인적으로 테스트되었으며 유효함) 이 장치에 드라이버를 로드할 수 없습니다. 어떻게 해결합니까? (개인적으로 테스트되었으며 유효함) Mar 14, 2024 pm 09:00 PM

이 장치에 드라이버를 로드할 수 없습니다. 어떻게 해결합니까? (개인적으로 테스트되었으며 유효함)

Linux에서 중국어 왜곡 문자를 해결하는 방법 Linux에서 중국어 왜곡 문자를 해결하는 방법 Feb 21, 2024 am 10:48 AM

Linux에서 중국어 왜곡 문자를 해결하는 방법

PyCharm이 열리지 않는 문제 해결 방법 공유 PyCharm이 열리지 않는 문제 해결 방법 공유 Feb 22, 2024 am 09:03 AM

PyCharm이 열리지 않는 문제 해결 방법 공유

See all articles