Ask a master to help solve a problem!

Source: Internet
Author: User
This code is a pop-up box, but the pop-up after the top and bottom of the page center, how to locate the popup box? For example, 100 pixels from the top.

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 ();
}



Upload image



Reply to discussion (solution)

What is a popup that seems to be some kind of JS plugin?
If it is, Baidu should have a way to use the document

What is a popup that seems to be some kind of JS plugin?
If it is, Baidu should have a way to use the document



I didn't find a way to fix it.

Put out the definition of Popup

popup.js********************/
Fixed IE5, IE6, IE7, firefox3.0 compatibility issues
///************************************************/
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= '

Pick up upstairs.

style= "Position:absolute;top:0px;left:0px;width:100%;height:100%;z-index: ' +basezindex+ '; ' +cb+ ' Background-color: ' +this.color.ccolor+ ';d isplay:none; " > '; var mainbox= '

"; if ( This.config.isHaveTitle) {mainbox+= ' '}else{mainbox+= ' '};mainbox+= '
' + ' ' + ' TD Width= "6" >
' +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); 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<1) stop= "a"; if (sleft<1) "sleft="; odialog[' style '[' Left ']=sleft+ ' px ', odialog[' style ' [' Top ']=stop+ ' px ';},reset:function () {if (this.config.isReloadOnClose) { Top.location.reload ();}; This.close ();},close:function () {G (' DialogBox '). style.display= ' None '; if (!this.config.isbackgroundcanclick) G (' Dialogboxbg '). style.display= ' None '; if (This.config.isShowShadow) G (' Dialogboxshadow '). style.display= ' None '; G (' Dialogbody '). innerhtml= '; This.showsome ();},hiddensome:function () {var tag=this.info.somehiddentag.split (",") if (tag.length==1&&tag[0]== "") {tag.length=0;} for (Var j=0;j

Pick up upstairs.

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)};d ocument.body.style.cursor= "move";},mouseup: function (event) {if (!this. isdraging) return;if (this.contenttype==1) G ("IFRAMEBG"). style.display= "None";d ocument.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 (mousx<1| | mousy<1| | mousx>document.body.clientwidth| | mousy>document.body.clientheight| | parseint (this.oObj.style.left) <0| | parseint (this.oObj.style.top) <0| | oobjright>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", "Login"), 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);p op.setcontent ("Alertcon", content);p op.build ();p op.show ();} function Wclose () {g_pop.close (); g_pop=null;}

Just use Chrome and other browser developer tools to view the HTML generated by the popup, and then directly define the corresponding CSS style.

Just use Chrome and other browser developer tools to view the HTML generated by the popup, and then directly define the corresponding CSS style.


Of course, this is a violent method, but absolutely effective. Perhaps the popup plugin itself has the method of positioning, but too lazy to study the search.

So many popup plugins, no documents do not know to change a plugin?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.