Antworten auf deine Fragen:
Neues Thema erstellen

Antworten zum Thema „Scrolltext“

C

cutdriverscrewat

Guest

Hiho liebe Community,
ich hab da eine kleine Frage. Und zwar bin ich gerade dabei die Webseite für unsere Truppe (DJ/MC - Drum n Bass - Goa) zu überarbeiten. Da ich aber nur einen sehr kleinen Content Bereich habe, dachte ich mir, ich baue einen ScrollText ein.

Jetzt habe ich von einer Webseite sowas heruntergeladen alles so gemacht wie es gemacht werden sollte, nur leider scrollt er da nichts :(

Hat jemand vl. einen Ansatz voran es liegen könnte, oder kennt jemand vl. ein neueres Teil das das was ich benutze? Ist aus dem Jahre 2001 :)

So hier mal der Code:

CSS (Diese 4 ID's sind dafür im CSS zuständig):

HTML:
#divUp {
    position: absolute;
    left: 606px;
    top: 76px;
}

#divDown {
    position: absolute;
    left: 606px;
    top: 428px;
}

#divScrollTextCont {
    position:absolute;
    top: 73px;
    left: 29px;
    width: 600px;
    height: 377px;
    clip: rect (0px 555px 375px 0px);
    overflow:hidden;
    visibility:visible;
    font-family: Verdana;
    font-size: 10px;
    color: #000000;
}

#divText {
    position: absolute; 
    left:0px; 
    top:0px;
    width: 575px;
}
HTML (index.html)
zuerst mal der JavaScript Code
HTML:
<script language="JavaScript" type="text/javascript">
/**********************************************************************************   
ScrollText 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
    this.ver=navigator.appVersion
    this.agent=navigator.userAgent
    this.dom=document.getElementById?1:0
    this.opera5=this.agent.indexOf("Opera 5")>-1
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    this.ie=this.ie4||this.ie5||this.ie6
    this.mac=this.agent.indexOf("Mac")>-1
    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
    return this
}
var bw=new lib_bwcheck()


var speed = 30

//Sets variables to keep track of what's happening
var loop, timer

//Object constructor
function makeObj(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
      this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
    this.up=goUp;this.down=goDown;
    this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function moveIt(x,y){
    this.x = x
    this.y = y
    this.css.left = this.x+px
    this.css.top = this.y+px
}

//Makes the object go up
function goDown(move){
    if (this.y>-this.scrollHeight+oCont.clipHeight){
        this.moveIt(0,this.y-move)
            if (loop) setTimeout(this.obj+".down("+move+")",speed)
    }
}
//Makes the object go down
function goUp(move){
    if (this.y<0){
        this.moveIt(0,this.y-move)
        if (loop) setTimeout(this.obj+".up("+move+")",speed)
    }
}

//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
    if (scrolltextLoaded){
        loop = true;
        if (speed>0) oScroll.down(speed)
        else oScroll.up(speed)
    }
}

//Stops the scrolling (called on mouseout)
function noScroll(){
    loop = false
    if (timer) clearTimeout(timer)
}
//Makes the object
var scrolltextLoaded = false
function scrolltextInit(){
    oCont = new makeObj('divScrollTextCont')
    oScroll = new makeObj('divText','divScrollTextCont')
    oScroll.moveIt(0,0)
    oCont.css.visibility = "visible"
    scrolltextLoaded = true
}
//Call the init on page load if the browser is ok...
if (bw.bw) onload = scrolltextInit

</script>
HTML (Hier wird es angewendet)
HTML:
<div id="divUp"><a href="#" onMouseOver="scroll(-3)" onMouseOut="noScroll()" onClick="return false"><img src="images/scrollerup.jpg" alt="" name="" width="20" height="19" border="0"></a></div>
    <div id="divDown"><a href="#" onMouseOver="scroll(3)" onMouseOut="noScroll()" onClick="return false"><img src="images/scollerdown.jpg" alt="" name="" width="20" height="19" border="0"></a></div>
    <div id="divScrollTextCont">
    <div id="divText">
      asdasd
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>asdasdadd</p>
    </div>
    </div>

Bitte nicht vor diesen &nbsp; erschrecken, ist nur für Testzwecke :)

Wäre cool wenn Ihr mir da was dazu sagen könnt!

Achja wer das ganze LIVE sehen will, (WIP)

lg Alex
 

stb_87

Web-Sheriff - ohne Bild

AW: Scrolltext

Moin,

#divtext {
overflow: auto;
height: irgendwas;
width: irgendwas;
}

...und noch die restlichen Angaben.

Das reicht dafür!
Der Rest, dieser JavaSkript-Kram ist total überflüssig...
 
C

cutdriverscrewat

Guest

AW: Scrolltext

Danke für die Antwort! Werde ich heute mal nach der Arbeit umsetzen.

lg Alex
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Flatrate für Tutorials, Assets, Vorlagen

Statistik des Forums

Themen
175.158
Beiträge
2.581.880
Mitglieder
67.226
Neuestes Mitglied
Alec168
Oben