세로롤링
페이지 정보
작성자 MintState 댓글 0건 조회 17,152회 작성일 08-11-17 13:56본문
세로롤링
테이블도 적용 가능 합니다.
scrollerheight, amount 를 조절....
테이블도 적용 가능 합니다.
scrollerheight, amount 를 조절....
<script type="text/javascript"> var scrollerheight=20; // 스크롤러의 세로 var html,total_area=0 var scroll_interval; var scrollspeed = 1; // Scrolling 속도 var waitingtime = 2000; // 멈추는 시간 var s_tmp = 0, s_amount = 20; var startPanel=0, n_panel=0, i=0; var scroll_img_view_check = 0; function startscroll() { // 스크롤 시작 i=0; for (i in scroll_content) n_panel++; n_panel = n_panel -1 ; startPanel = Math.round(Math.random()*n_panel); if(startPanel == 0) { i=0; for (i in scroll_content) insert_area(total_area, total_area++); // area 삽입 } else if(startPanel == n_panel) { insert_area(startPanel, total_area); total_area++; for (i=0; i<startPanel; i++) { insert_area(i, total_area); // area 삽입 total_area++; } } else if((startPanel > 0) || (startPanel < n_panel)) { insert_area(startPanel, total_area); total_area++; for (i=startPanel+1; i<=n_panel; i++) { insert_area(i, total_area); // area 삽입 total_area++; } for (i=0; i<startPanel; i++) { insert_area(i, total_area); // area 삽입 total_area++; } } scroll_interval = setInterval("scrolling()", waitingtime); } function scrolling(){ // 실제로 스크롤 하는 부분 if (scroll_content_act) { for (i=0;i<total_area;i++){ tmp = document.getElementById('scroll_area'+i).style; tmp.top = parseInt(tmp.top)-scrollspeed; if (parseInt(tmp.top) <= -scrollerheight){ tmp.top = scrollerheight*(total_area-1); } } if (s_tmp++ >= (s_amount - 1)){ if (scroll_img_view_check%2 == 0){ clearInterval(scroll_interval); s_tmp = 0; scroll_interval = setInterval("scrolling()", waitingtime); return; } } } clearInterval(scroll_interval); scroll_interval = setInterval("scrolling()", 1); } function scrolling_next(){ // 실제로 스크롤 하는 부분 for (i=0;i<total_area;i++){ tmp = document.getElementById('scroll_area'+i).style; var start = tmp.top; if (parseInt(tmp.top) <= 0) { tmp.top = scrollerheight*(total_area - 1); } else { if (parseInt(tmp.top)%scrollerheight == 0) tmp.top = parseInt(parseInt(tmp.top)/scrollerheight - 1)*scrollerheight; else tmp.top = parseInt(parseInt(tmp.top)/scrollerheight)*scrollerheight; } } clearInterval(scroll_interval); s_tmp = 0; scroll_interval = setInterval("scrolling()", waitingtime); } function insert_area(idx, n){ // area 삽입 html='<span style="left: 0px; position: absolute; top: '+(scrollerheight*n)+'px" id="scroll_area'+n+'">'; html+=scroll_content[idx]+'\n'; html+='</span>\n'; document.write(html); } var cur_scroll_content = 0; var scroll_content_act = true; function next_view() { scrolling_next(); } function set_media_content() { ++cur_scroll_content; if (cur_scroll_content >= scroll_content.length) cur_scroll_content = 0; } //--> </script> <div onmouseover="scroll_content_act=false;" onmouseout="scroll_content_act=true;" style="border:0; width:142; height:600; overflow:hidden;"> <script> var scrollerheight=40; // 스크롤러의 세로 var html,total_area=0 var scroll_interval; var scrollspeed = 1; // Scrolling 속도 var waitingtime = 2000; // 멈추는 시간 var s_tmp = 0, s_amount = 40; var startPanel=0, n_panel=0, i=0; var scroll_img_view_check = 0; var newsVar = 0; var scroll_content= new Array(); scroll_content[0]="<table border=1><tr><td>00</td></tr><tr><td>aa</td></tr></table>"; scroll_content[1]="<table border=1><tr><td>11</td></tr><tr><td>bb</td></tr></table>"; scroll_content[2]="<table border=1><tr><td>22</td></tr><tr><td>cc</td></tr></table>"; scroll_content[3]="<table border=1><tr><td>33</td></tr><tr><td>dd</td></tr></table>"; scroll_content[4]="<table border=1><tr><td>44</td></tr><tr><td>ee</td></tr></table>"; scroll_content[5]="<table border=1><tr><td>55</td></tr><tr><td>ff</td></tr></table>"; startscroll(); </script> </div>
|
댓글목록
등록된 댓글이 없습니다.