FULLPAGE BACKGROUND-TICKER

Moderator: HTML-Laie

Antworten
Benutzeravatar
Hape
Administrator
Beiträge: 336
Registriert: Fr 22. Mai 2020, 00:33

FULLPAGE BACKGROUND-TICKER

Beitrag von Hape »

Dies ist ein Hintergrund-Ticker, der die volle Breite Ihrer Webseite nutzt, um Ihre Nachrichten im Hintergrund zu animieren. Einfache Konfiguration von Meldungen, Geschwindigkeit und Schriftattributen wie Schriftfarbe, Schriftfamilie, Schriftgröße, Schriftstärke und mehr.

Code: Alles auswählen

<script>
// CREDITS:
// Fullpage Background-Ticker 2.1 by Peter Gehrig 
// Copyright (c) 2010 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.fabulant.com.

// IMPORTANT: 
// If you add this script to a script-library or a script-archive 
// you have to insert a link to http://www.fabulant.com right into the webpage where the script
// will be displayed.

// Set your messages. You may add as many messages as you like.
var message=new Array()
message[0]="This smart background ticker uses the full width of the webpage to display your messages."
message[1]="Add as many messages as you like. Easy configuration of messages, speed and font attributes."
message[2]="Crossbrowser. Brought to you by www.fabulant.com."

// Set font-family of the text
var fnt="Arial"

// Set font-size of the text (CSS-values)
var fntsize=64

// Set font-color of the text
var fntcolor="#CCCCCC"

// Set font-color of the last letter of the ticker
var fntcolorlastletter="#666666"

// Set font-weight. Set a value between 1 to 9 to adjust the boldness
var fntweight=7

// Set standstill between the messages (seconds)
var standstill=2

// Set speed (higher=slower)
var speed=80

// the top-position of the ticker (distance to the border on top, pixels)
var topposition=200

// the left-position of the ticker (distance to the border on the left, pixels)
var leftposition=20

// Do not edit the variables below
var tickerwidth
var tickerheight
var i_substring=0
var i_presubstring=0
var i_message=0
var messagecontent=""
var messagebackground=""
var messagepresubstring=""
var messageaftersubstring=""
fntweight=fntweight*100
standstill*=1000

var browserinfos=navigator.userAgent 
var ie4=document.all&&!document.getElementById&&!browserinfos.match(/Opera/)
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns4=document.layers
var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
var opera=browserinfos.match(/Opera/)  
var browserok=ie4||ie5||ns4||ns6||opera

for (i=0;i<=message.length-1;i++) {
	message[i]=message[i]+" "
}

function initiateticker() {
	tickerheight=document.body.clientHeight-5
    tickerwidth=document.body.clientWidth-5
	document.getElementById('ticker').style.left=leftposition
	document.getElementById('ticker').style.top=topposition
	showticker()
}

function getmessagecontent() {
	messagepresubstring=message[i_message].substring(0,i_presubstring)
	messageaftersubstring=message[i_message].substring(i_presubstring,i_substring)
	messagecontent="<table border=0 width="+tickerwidth+" height="+tickerheight+"><tr><td valign=top>"
	messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsize+"pt;font-weight:"+fntweight+"'>"	
	messagecontent+="<font color='"+fntcolor+"'>"
	messagecontent+=messagepresubstring
	messagecontent+="</font>"
	messagecontent+="</span>"
	messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsize+"pt;font-weight:900'>"	
	messagecontent+="<font color='"+fntcolorlastletter+"'>"
	messagecontent+=messageaftersubstring
	messagecontent+="</font>"
	messagecontent+="</span>"
	messagecontent+="</td></tr></table>"
}

function showticker() {
	if (i_substring<=message[i_message].length-1) {
		i_substring++
		i_presubstring=i_substring-1
		if (i_presubstring<0) {i_presubstring00}
		getmessagecontent()
		document.getElementById('ticker').innerHTML=messagecontent
		var timer=setTimeout("showticker()", speed)
	}
	else {
		clearTimeout(timer)
		var timer=setTimeout("changemessage()", standstill)
	}
}

function changemessage() {
	i_substring=0
	i_presubstring=0
	i_message++
	if (i_message>message.length-1) {
		i_message=0
	}
	showticker()
}
if (browserok) {window.onload=initiateticker}
</script>
<div id="ticker" style="position:absolute"></div>
<div id="do_not_delete_this" style="position:relative">
Demoseite dazu hier: Background-Ticker

Antworten