JS 隨機漂浮物

2021-06-05 01:07:47 字數 2166 閱讀 5516

js**:

function addevent(obj, evttype, func, cap) else if (obj.attachevent) else

} else

}function getpagescroll() else if (document.documentelement && document.documentelement.scrollleft) else if (document.body)

if (self.pageyoffset) else if (document.documentelement && document.documentelement.scrolltop) else if (document.body)

arraypagescroll = new array(xscroll, yscroll);

return arraypagescroll;

}function getpagesize() else if (document.body.scrollheight > document.body.offsetheight) else

var windowwidth, windowheight;

if (self.innerheight) else if (document.documentelement && document.documentelement.clientheight) else if (document.body)

if (yscroll < windowheight) else

if (xscroll < windowwidth) else

arraypagesize = new array(pagewidth, pageheight, windowwidth, windowheight)

return arraypagesize;

}var admoveconfig = new object();

admoveconfig.isinitialized = false;

admoveconfig.scrollx = 0;

admoveconfig.scrolly = 0;

admoveconfig.movewidth = 0;

admoveconfig.moveheight = 0;

admoveconfig.resize = function()

admoveconfig.scroll = function()

addevent(window, "resize", admoveconfig.resize);

addevent(window, "scroll", admoveconfig.scroll);

function admove(id)

var obj = document.getelementbyid(id);

obj.style.position = "absolute";

var w = admoveconfig.movewidth - obj.offsetwidth;

var h = admoveconfig.moveheight - obj.offsetheight;

var x = w * math.random(), y = h * math.random();

var rad = (math.random() + 1) * math.pi / 6;

var kx = math.sin(rad), ky = math.cos(rad);

var dirx = (math.random() < 0.5 ? 1 : -1), diry = (math.random() < 0.5 ? 1 : -1);

var step = 1;

var interval;

this.setlocation = function(vx, vy)

this.setdirection = function(vx, vy)

obj.custommethod = function()

if (x > w)

y = y + step * ky * diry;

if (y < 0)

if (y > h)

}this.run = function()

obj.onmouseout = function() }}

html**:

76運輸機觀測到白色漂浮物

新華網伊爾 76運輸機3月24日電 記者黃書波 正在南印度洋海域上空進行搜尋馬航失聯客機工作的中國伊爾 76運輸機機組人員24日在海上觀測到白色漂浮物,目前已通報澳方指揮中心和中國 雪龍 號科考船。機組人員發現的白色漂浮物位置在東經95.1113度,南緯42.5453度。從萬公尺高空看,其中2塊漂浮...

JS 實現網頁漂浮廣告

首先建立乙個名為 ad.js 的檔案,以下為檔案內容 漂浮廣告 begin 可設定漂浮是否為flash以及顯示大小 var brok false var mie false var vmin 2 var vmax 5 var vr 1 var timer1 var chinazads var isf...

基於JQuery網頁漂浮廣告視窗Js詳解

自 浮窗css樣式 html內容自己寫 關閉 js 廣告漂浮視窗 function floatad selector 把元素設定成在頁面中間 obj.show 元素預設是隱藏的,避免上一句 改變位置視覺突兀,改變位置後再顯示出來 var handler setinterval move,delay ...