Use script package to facilitate website suspension advertisements

zhaozj2021-02-12  207

Here is the js script (floatdiv.js) / * ======================================= ================================ Floating block Support script design by: Peng Guo, Date: HTTP: 002-26 Site: http: //kacarton.yeah.net/ blog: http://blog.9cbs.net/nhconch email: kacarton@sohu.com Articles are original, please contact me before reprinting, please indicate the article, keep the author Information, thank you! ============================================================================================================================================================================================================= ==================== * / var alleft = 0, alCenter = 1, alright = 2; // horizontal alignment var Altop = 0, almiddle = 1, Albottom = 2; // Vertical alignment var f = new array (); var CNT = 0; Function Floatdiv (Objid, Align, Valign, X, Y, Smooth) {/ * Floating block object data structure: Objid: Object ID Align : Horizontal alignment, enumeration type VALIGN: vertical alignment, enumeration content x, y: xy coordinate, integer smooth: smooth moving, Boolean * / this.objid = Objid; this.Align = align .valign = valign; this.x = x; this.y = y; this.smooth = smooth;} Function adddiv (Objid, Align, Valign, X, Y, Smooth) {// Add floating block F [CNT ] = New Floatdiv (Objid, Align, Valign, X, Y, Smooth);

} Function floatmove () {// Repositions Var objx, objy; if (Document.all) {var D = document.body; // status = "scrollleft: f [0] .objid.style. Pixeltop "| OffsetWidth: D.OffSetWidth; for (var i = 0; i

WINDOW.INNERWIDTH - F [i] .x - document.objid.width; break;} switch (f [i] .valign) {copy altop: objy = pageyoffset f [i] .y; break; case almiddle: Objy = PageYoffset Math.ceil (Window.innerHeight / 2) f [i] .y; break; case albottom: objy = pageyoffset window.innerHeight - f [i] .y - document.objid.height; break;} IF (t [i] .smooth) Smoothmove (f [i] .objid, objx, objy); else {document.objid.LSE {document.objid.LSE = objx; Document.objid.top = Objy;}}} settimeout ("floatmove () ", 50);} function smoothmove (obj, x, y) {var percent; if (document.all) {percent = .1 * (x - obj.style.pixelleft); if (percent> 0) percent = Math.ceil (Percent); Else Percent = math.floor (percent); obj.style.pixelleft = percent; percent = .1 * (y - obj.style.pixeltop); if (percent> 0) percent = Math .ce IL (Percent); Else Percent = Math.Floor (Percent); obj.style.pixeltop = percent;} if (document.Layers) {percent = .1 * (x - document.objid.Left); if (Percent > 0) Percent = math.ceil (percent); else percent = math.floor; document.objid.LEFT = percent; percent = .1 * (Y - Document.objid.top); if (Percent> 0) Percent = math.ceil (percent); else percent = math.floor (percent); document.objid.top = percent;}} settimeout ("floatmove ();", 50); Call example: