CSS
#slidemenu{position:absolute;right:5px;}
HTML
<div id="slidemenu">
<table width=85 border=0 cellpadding=0 cellspacing=0 style="border-collapse:collapse;">
<tr height=40 bgcolor='#0080ff'><td align=center valign=middle><a href="#" onclick='back_top();'><b>Top</b></a></td></tr>
<tr height=25 bgcolor='#cb97ff'><td align=center valign=middle><a href="#" onclick='FuncUpdate();'>Save</a></td></tr>
</table>
</div>
<script language=javascript>
var scroll_pixel,div_pixel,gotopos,gbpos,loop,moving_spd;
var top_margin = 145;
var top_margin2 = 145;
var speed = 10;
var speed2 = 9;
var moving_stat = 1;
function check_scrollmove()
{
scroll_pixel = document.body.scrollTop;
gotopos = document.body.scrollTop+top_margin;
gbpos = document.body.scrollTop+top_margin2;
if(slidemenu.style.pixelTop < gotopos)
{
moving_spd = (gbpos-slidemenu.style.pixelTop)/speed;
slidemenu.style.pixelTop += moving_spd;
}
if(slidemenu.style.pixelTop > gotopos)
{
moving_spd = (slidemenu.style.pixelTop-gotopos)/speed;
slidemenu.style.pixelTop -= moving_spd;
}
loop = setTimeout("check_scrollmove()",speed2);
}
function moving_control()
{
if(!moving_stat)
{
check_scrollmove();
moving_stat = 1;
}
else
{
clearTimeout(loop);
moving_stat = 0;
slidemenu.style.pixelTop = top_margin;
}
}
check_scrollmove();
function back_top()
{
x = document.body.scrollLeft;
y = document.body.scrollTop;
step = 2;
while ((x != 0) || (y != 0)) {
scroll (x, y);
step += (step * step / 300);
x -= step;
y -= step;
if (x < 0) x = 0;
if (y < 0) y = 0;
}
scroll (0, 0);
}
</script>
'programmer > web script' 카테고리의 다른 글
[php]폴더 생성(상위 폴더 자동 생성) (1) | 2011.08.01 |
---|---|
[php]파일 및 폴더 찾아서 정리하기 (0) | 2011.08.01 |
[java script]그라데이션(Gradation) 처리 (0) | 2011.08.01 |
[php]zip(압축) 활용 (0) | 2011.08.01 |
apache & jsp & php & mysql 설치 및 설정 (0) | 2011.08.01 |