Willkommen auf dem Portal für Mediengestalter
|
|
Autor |
Nachricht |
mirok
Threadersteller
Dabei seit: 02.01.2006
Ort: Nürnberg
Alter: -
Geschlecht: -
|
Verfasst Fr 06.10.2006 15:43
Titel Javascript-Newsticker reagiert im IE anders... |
|
|
Hallo
noch eine Frage:
habe einen Newsticker, dieser funktioniert in jedem Browser wie er soll, ausser im IE. Normalerweise bleibt er bei jedem Punkt stehen und scrollt dann weiter. Im IE scrollt er alle Punkte durch und bleibt erst dann stehen..
Hier der Code:
<script blabla>
var scroller;
scroller = new Scroller(document.getElementById('boundary'), document.getElementById('container'));
scroller.start();
</script>
<div style="position:relative; height: 130px; overflow:hidden; margin-top:5px;" id="boundary">
<div style="position:absolute;" id="container">
<div style="height: 150px" scrollDelay="4000">
Content 1
</div>
<div style="height: 150px" scrollDelay="4000">
Content 2
</div>
<div style="height: 150px" scrollDelay="4000">
Content 3
</div>
</div>
</div>
Die Funktionen der js-Datei:
var scrollers = new Array();
var scCount = 0;
function Scroller(bound, content) {
this.Id = ++scCount;
scrollers[this.Id] = this;
this.Bound = bound;
this.Content = content;
this.StartDelay = 500;
this.StepSize = 1;
this.StepDelay = 10;
this.Position = 500;
this.DelayPositions = new Array();
}
Scroller.prototype.start = function p_start() {
this.SecondContent = this.Content.cloneNode(true);
this.Bound.appendChild(this.SecondContent);
this.SecondContent.style.top = this.Content.offsetHeight;
window.setTimeout("_p_next(" + this.Id + ")", this.StartDelay);
for (var pos = 0; pos < this.Content.childNodes.length; pos++) {
var node = this.Content.childNodes[pos];
if (node.tagName) {
var delay = node.getAttribute("scrollDelay");
if (delay) {
this.DelayPositions[node.offsetTop] = delay;
}
}
}
}
Scroller.prototype.next = function p_start() {
if (this.Position == this.Content.offsetHeight) {
this.Position = 0;
var c = this.Content;
this.Content = this.SecondContent;
this.SecondContent = c;
this.SecondContent.style.clip = "rect(auto auto auto auto)";
this.Content.style.clip = "rect(auto auto auto auto)";
} else {
this.Position += this.StepSize;
}
var delay = this.StepDelay;
if (this.DelayPositions[this.Position]) {
delay = this.DelayPositions[this.Position];
}
if (this.Position > this.Content.offsetHeight) {
this.Position = this.Content.offsetHeight;
}
this.Content.style.clip = "rect(" + this.Position + " auto auto auto)";
this.Content.style.top = -this.Position;
this.SecondContent.style.top = this.Content.offsetHeight-this.Position;
window.setTimeout("_p_next(" + this.Id + ")", delay);
}
function _p_next(id) {
scrollers[id].next();
}
|
|
|
|
|
aklein
Dabei seit: 23.02.2006
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Di 10.10.2006 14:40
Titel
|
|
|
Hi, versuch den mal, der macht genau das was Du willst und funktioniert auch bei mir im IE:
Code: |
<div id="tempholder"></div>
<script language="JavaScript" src="dhtmllib.js"></script>
<script language="JavaScript" src="scroller.js"></script>
<script language="JavaScript">
//SET SCROLLER APPEARANCE AND MESSAGES
var myScroller1 = new Scroller(0, 0, 480, 32, 1, 5); //(xpos, ypos, width, height, border, padding)
myScroller1.setColors("#006600", "#ccffcc", "#009900"); //(fgcolor, bgcolor, bdcolor)
myScroller1.setFont("Verdana,Arial,Helvetica", 2);
myScroller1.addItem("<b>Click here for <a href='http://dynamicdrive.com'>Dynamic Drive</a>, the net\'s #1 DHTML site!</b>");
myScroller1.addItem("<b>Visit <a href='http://www.brainjar.com'>Brain Jar</a>, Mike\'s great coding site!</b>");
myScroller1.addItem("<b>Looking for free JavaScripts? Visit <a href='http://javascriptkit.com'>JavaScript Kit.</a>");
myScroller1.addItem("<b>Discuss and get help on web coding, at <a href='http://www.codingforums.com'>CodingForums.com</a></b>");
//SET SCROLLER PAUSE
myScroller1.setPause(2500); //set pause beteen msgs, in milliseconds
function runmikescroll() {
var layer;
var mikex, mikey;
// Locate placeholder layer so we can use it to position the scrollers.
layer = getLayer("placeholder");
mikex = getPageLeft(layer);
mikey = getPageTop(layer);
// Create the first scroller and position it.
myScroller1.create();
myScroller1.hide();
myScroller1.moveTo(mikex, mikey);
myScroller1.setzIndex(100);
myScroller1.show();
}
window.onload=runmikescroll
</script>
<div id="placeholder" style="position:relative; width:420px; height:32px;"> </div>
|
|
|
|
|
|
Anzeige
|
|
|
|
|
|
Ähnliche Themen |
Newsticker...wie?
newsticker wie apple?
Flash Newsticker
Flash newsticker
suche > vertical > newsticker ..
Flash Newsticker mit Adminfunktion gesucht
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|