Ask experts to help solve a problem!

Source: Internet
Author: User
Ask experts to help solve a problem! This code is a pop-up box, but it is located at the top, bottom, and center of the page. how can I locate this pop-up box? For example, the distance from the top is 100 pixels.

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 images



Reply to discussion (solution)

What does popup look like a js plug-in?
If yes, Baidu should have a usage document.

What does popup look like a js plug-in?
If yes, Baidu should have a usage document.



No solution found

Post the definition of Popup

/// ********************* Popup. js ********************/
/// Corrected ie5, ie6, ie7, and 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 ='

Connect to the building

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. issuppdragdraging) {dropClass = new Dragdrop (this. config. width, this. config. height, this.info. shadowWidth, this. config. issuppdragdraging, 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. con TentType = 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 () {v Ar 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 ['St Yle '] ['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); v Ar sTop = iTop> 0? ITop :( sClientHeight/2 + sScrollTop)-(oDialog. offsetHeight/2); if (sTop <1) sTop = "20"; if (sleft <1) sleft = "20 "; 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

Connect to the building

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.doc umentElement. scrollLeft | document. body. scrollLeft); var mousyuncevent.pointery(event0000-(document.doc umentElement. 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); pop. setContent ("alertCon", content); pop. build (); pop. show () ;}function Wclose () {g_pop.close (); g_pop = null ;}

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

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


Of course, this is a brute force method, but it is absolutely effective. Maybe the Popup plug-in itself has a method for locating, but you are too lazy to look for it.

So many Popup plug-ins, no documentation do not know to change a plug-in?

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.