⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 n2corelibs-simplepopover-41238.js

📁 模拟amazon.com的窗口弹出效果,当鼠标移到图片上时弹出模拟的窗口
💻 JS
📖 第 1 页 / 共 3 页
字号:
if (this.sBorderStyle == 'none') {gp+='n2PopNoBorder';} else {gp+='n2Pop';}gp+='" style="display:inline; visibility:hidden; left:0px; top:0px;"';gp+='onMouseOver="' + objectID + '.mouseOver();" onMouseOut="' + objectID + '.mouseOut(event);"';gp+='onMouseMove="' + objectID + '.mouseMove(event);">';gp+='<span class="n2">';if (content) {gp+=content;} else {gp+='-- CONTENT GOES HERE (simple)--';}gp+='</span>';gp+='</span>';}var spanEl = document.createElement("span");spanEl.innerHTML = gp;spanEl.id = id +"_OuterX";document.body.insertBefore(spanEl,document.body.firstChild);};N2SimplePopover.prototype.createConnectorHTML = function() {var gp = '';var zOrder = 210;if (this.nPopLevel != null){zOrder += (this.nPopLevel * 20);}gp ='<div id="' + this.connID + '" style="position: absolute; z-index:' + zOrder + '; visibility: hidden; left: 0px; top: 0px;" ';gp+='onMouseOver="' + this.objectName + '.mouseOver();" onMouseOut="' + this.objectName + '.mouseOut(event);"';gp+='onMouseMove="' + this.objectName + '.mouseMove(event);">';gp+='<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">';if (this.locate == this._locateBelowLink) {gp+='<tr height="100%"><td background="' + this.oBorderImg['cl'] + '"><img src="' + this.sTransImg + '"></td><td width="100%" bgcolor="white"><img src="' + this.sTransImg + '"></td><td background="' + this.oBorderImg['cr'] + '"><img src="' + this.sTransImg + '"></td></tr>';gp+='<tr>';if (this.nHAdjust == 0) {gp+='<td><img src="' + this.oBorderImg['cl'] + '"></td>';} else {gp+='<td><img src="' + this.oBorderImg['ctl'] + '"></td>';}gp+='<td width="100%" bgcolor="white"><img src="' + this.sTransImg + '"></td>';if (this.nHAdjust == 'r') {gp+='<td><img src="' + this.oBorderImg['cr'] + '"></td>';} else {gp+='<td><img src="' + this.oBorderImg['ctr'] + '"></td>';}gp+='</tr>';} else if (this.locate == this._locateLinkRight) {gp+='<tr>';gp+='<td width="100%" background="' + this.oBorderImg['ct'] + '"><img src="' + this.sTransImg + '"></td>';if (this.nVAdjust == 0) {gp+='<td><img src="' + this.oBorderImg['ct'] + '"></td>';} else {gp+='<td><img src="' + this.oBorderImg['ctl'] + '"></td>';}gp+='</tr>';gp+='<tr height="100%">';gp+='<td width="100%" bgcolor="white"><img src="' + this.sTransImg + '"></td>';gp+='<td bgcolor="white"><img src="' + this.sTransImg + '"></td>';gp+='</tr>';gp+='<tr>';gp+='<td width="100%" background="' + this.oBorderImg['cb'] + '"><img src="' + this.sTransImg + '"></td>';if (this.nVAdjust == 'b') {gp+='<td><img src="' + this.oBorderImg['cb'] + '"></td>';} else {gp+='<td><img src="' + this.oBorderImg['cbl'] + '"></td>';}gp+='</tr>';}gp+='</table>';gp+='</div>';var connEl = document.createElement("span");connEl.innerHTML = gp;connEl.id = this.connID + "_OuterX";document.body.insertBefore(connEl, document.body.firstChild);};N2SimplePopover.prototype.saveCurrentElementData = function() { };N2SimplePopover.prototype._defaultPopulate = function(sAction, sID, sType, sParams, sLinkID, sHref, sLinkText) {;if (this.bLADSupported) {if (!this.isDataAvailable(sAction, sID, sType, sParams, sLinkID, sHref, sLinkText)) {return false;}}switch (sType) {case 'he': // id of an HTML elementthis.populateUsingElementContents(sID);break;case 'ak': // array keythis.populateUsingArrayContents(sID);break;case 'a':case 'am':case 'n':case 's':case 'l':break;default:;}if (this.bLADLoading) {this.sizeOrPositionChanged();}return true;};N2SimplePopover.prototype.populate = N2SimplePopover.prototype._defaultPopulate;N2SimplePopover.prototype.populateUsingElementContents = function(id, type, linkID, href, linkText) {;;var eElem = goN2U.getRawObject(id);if (eElem) {var tempHTML = eElem.innerHTML;if (this.bMoveHEContent) {this.sCurrentContent = eElem.innerHTML;this.sCurrentHeID = id;eElem.innerHTML = '';}this.setContent(tempHTML);} else {;}};N2SimplePopover.prototype.populateUsingArrayContents = function(id, type, linkID, href, linkText) {;;if (goN2U.isDefined(this.aDataArray) ) {if (goN2U.isDefined(this.aDataArray[id])) {this.setContent(this.aDataArray[id]);} else {;}}else {;}};N2SimplePopover.prototype.isDataAvailable = function(sAction, sID, sType, sParams, sLinkID, sHref, sLinkText) {;;if ( this._isDataAvailable (sAction, sID, sType, sParams, sLinkID,this.sLADKey, this.sLADField) ) {return true;} else {if (--this.nLADRetries && this.isVisible()) {if (!this.bLADLoading) {this.setContent(this.sLADLoadingMessage);this.bLADLoading = true;}setTimeout (new Function("", this.objectName + ".populate(" +"'" + (sAction ? sAction : 'null') + "'," +"'" + (sID ? sID : 'null') + "'," +"'" + (sType ? sType : 'null') + "'," +"'" + (sParams ? sParams : 'null') + "'," +"'" + (sLinkID ? sLinkID : 'null') + "'," +"'" + (sHref ? sHref : 'null') + "'," +"'" + (sLinkText ? sLinkText : 'null') + "'" +");"),this.nLADRetryMs);} else {;this.setContent(this.sLADTimeoutMessage);}return false;}};N2SimplePopover.prototype._isDataAvailable = function(sAction, sID, sType, sParams, sLinkID,sKey, sField) {;;var bIsAvailable = true;switch(sType) {case 'he': // id of an HTML elementif ( sKey && goN2U.getRawObject(sKey)=== null ) {bIsAvailable = false;} else if ( goN2U.getRawObject(sID)=== null ) {bIsAvailable = false;}break;case 'ak': // array keyif (this.aDataArray) {if ( sKey && goN2U.isUndefined(this.aDataArray[sKey]) ) {bIsAvailable = false;} else if ( goN2U.isUndefined(this.aDataArray[sID]) ) {bIsAvailable = false;}}break;case 'a':  // key is an ASIN (which means that the aDataArray should usually point ot gaTD)case 'am':var sTDKey = sType+sID;if (this.aDataArray) {if ( // an entry for this keygoN2U.isUndefined(this.aDataArray[sTDKey]) ||( sField && goN2U.isUndefined(this.aDataArray[sTDKey][sField]) ) ||( sKey && goN2U.isUndefined(this.aDataArray[sKey]) ) ||( sKey && sField && goN2U.isUndefined(this.aDataArray[sKey][sField]) )) {bIsAvailable = false;}}break;};return bIsAvailable;};N2SimplePopover.prototype.sizeOrPositionChanged = function () {if (this.myFeatureChangedCallback) {this.myFeatureChangedCallback(this);}};N2SimplePopover.prototype.updateLocation = function (flag){var po = this.popObj;this.left   = goN2U.getObjectLeft(po);this.top    = goN2U.getObjectTop(po);this.width  = goN2U.getObjectWidth(po);this.height = goN2U.getObjectHeight(po);this.right = this.left + this.width;this.bottom = this.top + this.height;};N2SimplePopover.prototype.isElementContained = function(elem) {var inPop = false;var test = this.popObj;if (goN2U.elementIsContainedBy(elem, this.popObj)) {inPop = true;} else if (this.bIsTabTitled) {if (goN2U.elementIsContainedBy(elem, goN2U.getElement(this.connID, true))) {inPop = true;} else if (goN2U.elementIsContainedBy(elem, this.oCurTabTitle) &&!goN2U.elementIsContainedBy(elem, this.oCurHotspot)) {inPop = true;}}return inPop;};N2SimplePopover.prototype.isCoordContained = function(x, y) {var inPop = false;var e = this.popObj;var left = goN2U.getPageElementLeft(e);var top = goN2U.getPageElementTop(e);var width = goN2U.getElementWidth(e);var height = goN2U.getElementHeight(e);if ((x >= left) && (x < left + width) && (y >= top) && (y < top + height)) {inPop = true;} else if (this.bIsTabTitled) {e = goN2U.getElement(this.connID, true);left = goN2U.getPageElementLeft(e);top = goN2U.getPageElementTop(e);width = goN2U.getElementWidth(e);height = goN2U.getElementHeight(e);if ((x >= left) && (x < left + width) && (y >= top) && (y < top + height)) {inPop = true;}e = this.oCurTabTitle;left = goN2U.getPageElementLeft(e);top = goN2U.getPageElementTop(e);width = goN2U.getElementWidth(e);height = goN2U.getElementHeight(e);if ((x >= left) && (x < left + width) && (y >= top) && (y < top + height)) {e = this.oCurHotspot;left = goN2U.getPageElementLeft(e);top = goN2U.getPageElementTop(e);width = goN2U.getElementWidth(e);height = goN2U.getElementHeight(e);if (!((x >= left) && (x < left + width) && (y >= top) && (y < top + height))) {inPop = true;}}}return inPop;}N2SimplePopover.prototype.mouseOver = function () {if (this.initialMouseOver) {;this.initialMouseOver = false;var ret = true;if (this.myMouseOverCallback) {;ret = this.myMouseOverCallback(this);}if (ret) {}}};N2SimplePopover.prototype.mouseMove = function (evt) {if (this.initialMouseOver) {this.mouseOver();}};N2SimplePopover.prototype.mouseOut = function (evt) {var inPop = false;var inChildPop = false;var oChildFeature = this.getChildPopover();evt = (evt) ? evt : ((window.event) ? window.event : null);if (evt) {if (goN2U.bIsIE) {inPop = this.isElementContained(evt.toElement);if (oChildFeature) {inChildPop = oChildFeature.isElementContained(evt.toElement);}} else {var x = evt.pageX;var y = evt.pageY;inPop = this.isCoordContained(x, y);if (oChildFeature){inChildPop = oChildFeature.isCoordContained(x, y);}}}if ( inChildPop ){this._makePopoverStatic(true);} else if (this.isParent() && !inPop) { //mouse is clearly out of the parentthis._makePopoverStatic(false);}if (!inPop && !this.cursorCanLeavePopover && !this.buttonIsDown) {;this.initialMouseOver = true;var ret = true;if (this.myMouseOutCallback) {;ret = this.myMouseOutCallback(this);;}if (ret) {;this.hide();}var oParentFeature = this.getParentPopover();if (oParentFeature) {oParentFeature._makePopoverStatic(false); //make parent non-static if this (child) popover has a mouse outoParentFeature.mouseOut(evt);}}};N2SimplePopover.prototype._hideTooltip = function (oLink) {var firstChild = oLink.firstChild;if (firstChild && firstChild.alt) {this.sImgAlt = firstChild.alt;firstChild.alt = '';}};N2SimplePopover.prototype.hookEvents = function () { };N2SimplePopover.prototype.unhookEvents = function () { };if (window.goN2LibMon) { goN2LibMon.endLoad('simplePopover'); }} // END library code wrappern2RunIfLoaded("events", n2SimplePopoverInitLibrary, "simplepopover");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -