브라우저 안에 떠다니는 이미지 ~ (플로팅 광고)

마우스 올리면 멈추고 마우스 떼면 움직이고 속도조절 가능하고 화면안에서만 움직이고,

그냥 찾다가 하나 얻어걸려서 올려요 ^^

<div id="img" style="width:200px; height:200px; position:absolute; left:50px; top:50px; z-index:1;">
<a href="http://www.여기에원하는주소"><img src="bird.gif" border="0" onMouseover="pauseResume();" onMouseout="pauseResume();"></a>
</div>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Justin Arruda (JArruda@mindspring.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var step = 1;    //높을수록 빠릅니다.
var delay = 50;  //delay입니다. 놓을수록 느리고 낮을수록 빠릅니다.
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
var name = navigator.appName;
if(name == "Microsoft Internet Explorer") name = true;
else name = false;
var xPos = 20;
if(name) var yPos = document.body.clientHeight;
else var yPos = window.innerHeight;
function changePos() {
if(name) {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
}
else {
height = window.innerHeight;
width = window.innerWidth;
Hoffset = document.img.clip.height;
Woffset = document.img.clip.width;
document.img.pageY = yPos + window.pageYOffset;
document.img.pageX = xPos + window.pageXOffset;
}
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
   }
}
function start() {
if(name) img.visibility = "visible";
else document.img.visibility = "visible";
interval = setInterval('changePos()',delay);
}
function pauseResume() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()',delay);
pause = true;
   }
}
start();
//  End -->
</script>

바디 안에다가 넣으면 됩니다 ^^

[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|

댓글 5개

댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
16년 전 조회 2,133
16년 전 조회 5,560
16년 전 조회 1,862
16년 전 조회 2,371
16년 전 조회 2,567
16년 전 조회 1,729
16년 전 조회 1,520
16년 전 조회 2,440
16년 전 조회 5,148
16년 전 조회 2,416
16년 전 조회 3,084
16년 전 조회 1,950
16년 전 조회 3,819
16년 전 조회 4,661
16년 전 조회 3,303
16년 전 조회 2,546
16년 전 조회 2,641
16년 전 조회 2,880
16년 전 조회 2,388
16년 전 조회 5,769
16년 전 조회 3,578
16년 전 조회 1,577
16년 전 조회 1,908
16년 전 조회 5,278
16년 전 조회 2,538
16년 전 조회 3,607
16년 전 조회 2,881
16년 전 조회 1,758
16년 전 조회 5,587
16년 전 조회 2,702
16년 전 조회 6,183
16년 전 조회 2,141
16년 전 조회 4,216
16년 전 조회 3,241
16년 전 조회 2,420
16년 전 조회 2,433
16년 전 조회 4,599
16년 전 조회 3,497
16년 전 조회 3,030
16년 전 조회 3,171
16년 전 조회 2,285
16년 전 조회 1,970
16년 전 조회 1,883
16년 전 조회 1,592
16년 전 조회 1,879
16년 전 조회 2,102
16년 전 조회 1,797
16년 전 조회 5,044
16년 전 조회 4,056
16년 전 조회 1,985
16년 전 조회 1,750
16년 전 조회 2,471
16년 전 조회 4,745
16년 전 조회 3,744
16년 전 조회 2,785
16년 전 조회 4,512
16년 전 조회 3,395
16년 전 조회 1,550
16년 전 조회 1,568
16년 전 조회 2,231
16년 전 조회 2,080
16년 전 조회 2,808
16년 전 조회 2,418
16년 전 조회 1,553
16년 전 조회 4,592
16년 전 조회 1,679
16년 전 조회 1,979
16년 전 조회 2,404
16년 전 조회 4,065
16년 전 조회 2,954
16년 전 조회 1,678
16년 전 조회 4,248
16년 전 조회 1,586
16년 전 조회 1,765
16년 전 조회 1,440
16년 전 조회 1,906
16년 전 조회 1,815
16년 전 조회 1,820
16년 전 조회 1,607
16년 전 조회 2,365
16년 전 조회 1,990
16년 전 조회 2,164
16년 전 조회 2,385
16년 전 조회 1,661
16년 전 조회 2,536
16년 전 조회 2,427
16년 전 조회 4,717
16년 전 조회 1,504
16년 전 조회 1,237
16년 전 조회 2,185
16년 전 조회 2,164
16년 전 조회 1,710
16년 전 조회 2,273
16년 전 조회 2,478
16년 전 조회 1,582
16년 전 조회 1,932
16년 전 조회 2,115
16년 전 조회 1,191
16년 전 조회 1,905
16년 전 조회 1,589