PDA

View Full Version : Making memory scroller vertical?



pasawayz
05-01-2006, 08:48 AM
Script: Memory Scroller
http://www.dynamicdrive.com/dynamicindex2/memoryscroller.htm

How can I make the script scroll something vertically?

djr33
05-01-2006, 09:21 AM
That's a bizarre idea because text doesn't go up and down.

totally untested guess that probably won't work without some more tweaking:

Basically... switch anything "horizontal" to "vertical", x to y, width to height, etc etc. and the reverse.

then for your content use
l<br>
i<br>
k<br>
e<br>
<br>
t<br>
h<br>
i<br>
s<br>

...ew, Heh.


Do you want do to images? I just saw a thread today with a cool script for that, but I can't seem to find where it is. I'll post if I do see it.
But... consider, if you're not, using images. that way you don't have to deal with a line break after every letter.

I don't think this is a great idea... but I can be convinced... why do you need vertical?

jscheuer1
05-01-2006, 09:32 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<script type="text/javascript">

/***********************************************
* Memory Scroller script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var memoryheight="150px" //scroller height
var memorywidth="200px" //scroller width
var memorybgcolor="#DEFDD9" //scroller background
var memorypadding="2px" //padding applied to the scroller. 0 for none.
var borderCSS="border: 1px solid black;" //Border CSS, applied to scroller to give border.

var memoryspeed=2 //Scroller speed (larger is faster 1-10)
var pauseit=1 //Pause scroller onMousever (0=no. 1=yes)?

var persistlastviewedmsg=1 //should scroller's position persist after users navigate away (1=yes, 0=no)?
var persistmsgbehavior="onload" //set to "onload" or "onclick".

//Specify the scroller's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):

var memorycontent='<div style="font: bold 13px Verdana">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a><br>&nbsp;<br>&nbsp; If you find this script useful, please consider <a href="http://www.dynamicdrive.com/link.htm">linking to</a> or <a href="http://www.dynamicdrive.com/recommendit/">recommending</a> Dynamic Drive.</div>'


////NO NEED TO EDIT BELOW THIS LINE////////////
var combinedcssTable="height:"+(parseInt(memoryheight)+6)+"px;background-color:"+memorybgcolor+";padding:"+memorypadding+";"+borderCSS+";"
var combinedcss="height:"+memoryheight+";width:"+memorywidth+";"

var divonclick=(persistlastviewedmsg && persistmsgbehavior=="onclick")? 'onClick="savelastmsg()" ' : ''
memoryspeed=(document.all)? memoryspeed : Math.max(1, memoryspeed-1) //slow speed down by 1 for NS
var copyspeed=memoryspeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<div id="temp" style="visibility:hidden;position:absolute;left:-100px;top:-10000px; width:'+memorywidth+';">'+memorycontent+'</div>')
var actualheight=''
var memoryscroller

if (window.addEventListener)
window.addEventListener("load", populatescroller, false)
else if (window.attachEvent)
window.attachEvent("onload", populatescroller)
else if (document.all || document.getElementById)
window.onload=populatescroller

function populatescroller(){
memoryscroller=document.getElementById? document.getElementById("memoryscroller") : document.all.memoryscroller
memoryscroller.style.top=parseInt(memoryheight)+8+"px"
if (persistlastviewedmsg && get_cookie("lastscrollerpos")!="")
revivelastmsg()
memoryscroller.innerHTML=memorycontent
actualheight=document.all? temp.offsetHeight : document.getElementById("temp").offsetHeight
toptime=setInterval("scrollmarquee()",20)
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function savelastmsg(){
document.cookie="lastscrollerpos="+memoryscroller.style.top
}

function revivelastmsg(){
lastscrollerpos=parseInt(get_cookie("lastscrollerpos"))
memoryscroller.style.top=parseInt(lastscrollerpos)+"px"
}

if (persistlastviewedmsg && persistmsgbehavior=="onload")
window.onunload=savelastmsg

function scrollmarquee(){
if (parseInt(memoryscroller.style.top)>(actualheight*(-1)+8))
memoryscroller.style.top=parseInt(memoryscroller.style.top)-copyspeed+"px"
else
memoryscroller.style.top=parseInt(memoryheight)+8+"px"
}

if (iedom){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0" style="'+combinedcssTable+'"><td>')
write('<div style="position:relative;overflow:hidden;'+combinedcss+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=memoryspeed">')
write('<div id="memoryscroller" style="position:absolute;top:0px;left:0px;" '+divonclick+'></div>')
write('</div>')
document.write('</td></table>')
}
}
</script>
</body>
</html>

pasawayz
05-03-2006, 10:13 PM
hmmm. looks like it could only scroll some chunks of HTML.

is it possible of having an IFRAME version of this?

jscheuer1
05-04-2006, 04:39 AM
hmmm. looks like it could only scroll some chunks of HTML.

is it possible of having an IFRAME version of this?

Hmmm, was the original script (http://www.dynamicdrive.com/dynamicindex2/memoryscroller.htm) you mentioned somehow iframe enabled that I missed? If so, how?

If not, you really must tell me more about how you want an iframe involved in this vertical version.

djr33
05-04-2006, 04:59 AM
I'm confused now as well.

learwbc
10-27-2006, 06:13 AM
Now that the memory scroller is able to scroll vertically, is it possible to make it pause? after a certain amount of pixels scrolled or maybe after a certain amount of seconds scrolled?

Hope someone can figure that out, then this script will be the ultimate scroller.

rap_0706
12-15-2006, 05:46 AM
I was trying to use the modified (vertical) version of the memory scroller to present data from mysql. However, in Netscape (6) it pushes all contents far below, and drags it up along with the scrolling text. In IE that does not happen. Is it possible to solve the problem?