메뉴 건너뛰기

전국분동대여

일반 자료실

컴퓨터/IT 항상 제자리에.. 스크롤 뉴스티커

GACHIMOA 2020.07.23 16:14 조회 수 : 437

항상 제자리에.. 스크롤 뉴스티커

 

<STYLE>
body{
overflow-x:hidden;
overflow-y:scroll;
}
</STYLE>
<SCRIPT>
// 메세제
var message=new Array()
message[0]="안녕하세요? 반갑습니다"
message[1]="여기는 자스코 입니다"
message[2]="쵝의 자바스크립트 소스뱅크죠"
// 메세지의 링크
var messageurl=new Array()
messageurl[0]="http://www.bizs.wo.ro"
messageurl[1]="http://www.yahoo.com"
messageurl[2]="http://www.altavista.com"
// 메세지의 타겟
var messagetarget=new Array()
messagetarget[0]="_blank"
messagetarget[1]="_blank"
messagetarget[2]="_blank"
// 메세지의 글자 색
var messagecolor= new Array()
messagecolor[0]="yellow"
messagecolor[1]="orange"
messagecolor[2]="FFFFFF"
// 스크롤러의 가로
var scrollerwidth=200
// 스크롤러의 세로
var scrollerheight=18
// 속도
var pause=20
var step=2
// 메세지의 글자크기
var fntsize=12
// 글자모양
var fntfamily="굴림"
// 글자의 두께 1=굵게, 0=보통
var fntweight=1
// 배경색
var backgroundcolor="000000"
// 테두리선 두께
var borderwidth=2
// CellPadding
var cellpad=10
var scrollerleft
var scrollertop
var screenwidth
var clipleft,clipright,cliptop,clipbottom
var i_message=0
var timer
var textwidth
var textcontent=""
var bgcontent=""
if (fntweight==1) {fntweight="700"}
else {fntweight="100"}
function init() {
        getbgcontent()
        gettextcontent()
    if (document.all) {
                screenwidth=document.body.clientWidth
                scrollertop=document.body.clientHeight+document.body.scrollTop-(scrollerheight+2*cellpad)
                scrollerleft=screenwidth/2-scrollerwidth/2
                text.innerHTML=textcontent
                bgscroller.innerHTML=bgcontent
                textwidth=text.offsetWidth
                document.all.bgscroller.style.posTop=scrollertop-cellpad
        document.all.bgscroller.style.posLeft=scrollerleft-cellpad
                document.all.text.style.posTop=scrollertop
        document.all.text.style.posLeft=scrollerleft+scrollerwidth
                clipleft=0
                clipright=0
                cliptop=0
                clipbottom=scrollerheight
                document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        scrolltext()
    }
        if (document.layers) {
                screenwidth=window.innerWidth
                scrollertop=pageYOffset+window.innerHeight-(scrollerheight+2*cellpad)
                scrollerleft=screenwidth/2-scrollerwidth/2
                document.text.document.write(textcontent)
                document.text.document.close()
                document.bgscroller.document.write(bgcontent)
                document.bgscroller.document.close()
                textwidth=document.text.document.width
                
                document.bgscroller.top=scrollertop-cellpad
        document.bgscroller.left=scrollerleft-cellpad
                document.text.top=scrollertop
                document.text.left=scrollerleft+scrollerwidth
                
                document.text.clip.left=0
                document.text.clip.right=0
                document.text.clip.top=0
                document.text.clip.bottom=scrollerheight
        scrolltext()
    }
}
function scrolltext() {
    if (document.all) {
                if (document.all.text.style.posLeft>=scrollerleft-textwidth) {
                        document.all.text.style.posLeft-=step
                        clipright+=step
                        if (clipright>scrollerwidth) {
                                clipleft+=step
                        }
                        document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
                        scrollertop=document.body.clientHeight+document.body.scrollTop-(scrollerheight+2*cellpad)
                        document.all.bgscroller.style.posTop=scrollertop-cellpad
                        document.all.text.style.posTop=scrollertop
                        var timer=setTimeout("scrolltext()",pause)
                }
                else {
                        changetext()
                }
        }
   if (document.layers) {
                if (document.text.left>=scrollerleft-textwidth) {
                        document.text.left-=step
                        document.text.clip.right+=step
                        if (document.text.clip.right>scrollerwidth) {
                                document.text.clip.left+=step
                        }
                        scrollertop=pageYOffset+window.innerHeight-(scrollerheight+2*cellpad)
                        document.bgscroller.top=scrollertop-cellpad
                        document.text.top=scrollertop
                        var timer=setTimeout("scrolltext()",pause)
                }
                else {
                        changetext()
                }
        }
}
function changetext() {
    i_message++
        if (i_message>message.length-1) {i_message=0}
        gettextcontent()
        if (document.all) {
                text.innerHTML=textcontent
                textwidth=text.offsetWidth
                
        document.all.text.style.posLeft=scrollerleft+scrollerwidth
                clipleft=0
                clipright=0
                document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
                
        scrolltext()
        }
        if (document.layers) {
                   document.text.document.write(textcontent)
                document.text.document.close()
                textwidth=document.text.document.width
                document.text.left=scrollerleft+scrollerwidth
                document.text.clip.left=0
                document.text.clip.right=0
                
        scrolltext()
        }
}
function gettextcontent() {
        textcontent="<span style='position:relative;font-size:"+fntsize+"pt;font-family:"+fntfamily+";font-weight:"+fntweight+";overflow-x:hidden'>"
        textcontent+="<a href="+messageurl[i_message]+" target="+messagetarget[i_message]+">"
        textcontent+="<nobr><font color="+messagecolor[i_message]+">"+message[i_message]+"</font></nobr></a></span>"
}
function getbgcontent() {
        var bgwidth=scrollerwidth+2*cellpad
        var bgheight=scrollerheight+2*cellpad
        bgcontent="<table border="+borderwidth+" width="+bgwidth+"  height="+bgheight+" cellpadding=0 cellspacing=0>"
        bgcontent+="<tr><td bgcolor="+backgroundcolor+"> "
        bgcontent+="</td></tr></table>"
}
window.onresize=init;
window.onload=init;
</script>
<DIV ID="bgscroller" style="position:absolute;"></DIV>
<DIV ID="text" style="position:absolute;"></DIV>

번호 제목 글쓴이
259 로딩바 만들기 GACHIMOA
258 로테이트 되는 텍스트 배너 만들기 GACHIMOA
257 glow 필터를 이용한 텍스트 글로우 효과 GACHIMOA
256 writingMode 의 스타일을 사용하여 텍스트를 가로 혹은 세로로 보여줍니다 GACHIMOA
255 메세지들을 타이핑하듯 멋지게 애니메이션 시킨 후 다른 페이지로 이동시킵니다 GACHIMOA
254 여러군데 흩어졌다가 차례대로 정열되는 텍스트 메세지들 GACHIMOA
253 예쁘게 스크롤 되는 풍선 도움말(툴팁) 스크립트 GACHIMOA
252 마우스를 대면 메뉴 텍스트가 선명해 집니다 GACHIMOA
251 인트로 페이지에 사용하면 좋은 텍스트 스크롤 효과 GACHIMOA
250 3가지 색상을 지정할 수 있는 네온텍스트 스크롤 효과 GACHIMOA
249 메뉴항목에 마우스를 대면 체크박스에 체크됩니다 GACHIMOA
248 글자에 네온효과를 주며 덮어 씁니다 GACHIMOA
247 문장을 거꾸로 보여줍니다 GACHIMOA
246 점점 커지는 언덕모양을 보여주는 텍스트 스크립트 입니다 GACHIMOA
245 텍스트 인삿말이 왼쪽에서 날아와 안착합니다 GACHIMOA
244 링크 텍스트에 부드럽게 바뀌는 롤오버 텍스트 효과를 보여줍니다 GACHIMOA
243 링크 텍스트에 마우스를 대면 페이드 효과를 보여줍니다 GACHIMOA
242 이미지 버튼에 마우스를 대면 커지는 효과를 보여줍니다 GACHIMOA
241 텍스트의 테두리가 반짝입니다 GACHIMOA
240 테이블에도 롤오버 효과를 줍니다 GACHIMOA
위로