function scrollLayer(p_obj_name, p_gap_point) 
{ 
	var start_point, end_point, timer;

	var obj_layer   = document.getElementById(p_obj_name);  // 레이어 오브젝트
	start_point = parseInt(obj_layer.style.top, 10);

	if ( start_point < p_gap_point )    start_point = p_gap_point;

	end_point   = document.body.scrollTop + p_gap_point; 
	limit_point = parseInt(window.document.body.scrollHeight) - parseInt(obj_layer.offsetHeight) -10;

	if ( end_point > limit_point )  end_point = limit_point;

	if ( start_point != end_point ) 
	{ 
		scroll_amount = Math.ceil( Math.abs( end_point - start_point ) / 15 ); 
		obj_layer.style.top = parseInt(start_point, 10) + ( ( end_point < start_point ) ? -scroll_amount : scroll_amount ); 
	}

	timer = window.setTimeout ("scrollLayer('" + p_obj_name + "', " + p_gap_point + ");", 1); 
}

scrollLayer('slide_banner',410);

'Language > Javascript' 카테고리의 다른 글

javascript checkbox all check  (0) 2010.04.22
lightbox2  (1) 2008.06.18

+ Recent posts