아

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

· 2009-08-12 (수) 15:22:56 · 3147 · 5

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

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

<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 ([email protected]) -->

<!-- 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개

2009-08-14 (금) 09:44:20
Good !!!!!! ^^
감사합니다^^
오오 소스가..ㅋㅋ
감사합니다.
써봐야겠네요
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
09-09-11 조회 5,680
09-08-14 조회 5,214
09-07-24 조회 5,925
09-07-17 조회 3,939
09-06-26 조회 5,161
09-06-25 조회 4,104
09-06-18 조회 5,325
09-05-16 조회 3,769
09-04-30 조회 3,376
09-04-02 조회 7,203
09-03-10 조회 3,348
09-01-30 조회 2,854
09-01-25 조회 3,533
09-01-24 조회 3,566
09-01-23 조회 3,808
09-01-20 조회 5,820
09-01-20 조회 4,255
09-01-14 조회 5,225
09-01-10 조회 3,049
09-01-09 조회 2,937
09-01-06 조회 2,856
09-01-05 조회 5,136
08-12-29 조회 4,313
08-12-20 조회 3,886
08-12-13 조회 4,499
08-12-12 조회 4,557
08-12-11 조회 2,674
08-11-26 조회 4,544
08-11-25 조회 3,675
08-11-25 조회 2,869
08-11-25 조회 4,439
08-11-25 조회 4,314
08-11-21 조회 4,299
08-11-20 조회 3,659
08-11-19 조회 3,936
08-11-19 조회 4,187
08-11-18 조회 3,966
08-11-15 조회 2,827
08-11-14 조회 3,193
08-11-13 조회 3,819
08-11-12 조회 9,939
08-02-22 조회 5,597
08-02-21 조회 4,540
08-02-21 조회 7,040