Go Back   Dynamic Drive Forums > DD Scripts > Dynamic Drive scripts help
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-09-2008, 06:18 AM
PZ5413 PZ5413 is offline
Junior Coders
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 100% Width for Memory Scroller

1) Script Title: Memory Scroller

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...ryscroller.htm

3) Describe problem:
I currently have this set to 1000px, which works fine with users using a 1024x768 resolution, but falls a bit short for anyone using a larger res, such as myself, and I'm sure many of you. I tried setting the memory width equal to 100% but all that did was set it to 100px instead. Is there anyway to set this scroller to a 100% width?

Here is where it's being used... it's a ticker along the bottom of the page:
http://www.pzfantasyfootball.com

Last edited by PZ5413; 02-09-2008 at 06:33 AM.
Reply With Quote
  #2  
Old 02-09-2008, 07:05 AM
ddadmin's Avatar
ddadmin ddadmin is offline
Administrator
 
Join Date: Aug 2004
Posts: 7,627
Thanks: 2
Thanked 639 Times in 629 Posts
Blog Entries: 13
Default

Try changing the lines:

Code:
var combinedcssTable="width:"+(parseInt(memorywidth)+6)+"px;background-color:"+memorybgcolor+";padding:"+memorypadding+";"+borderCSS+";"
var combinedcss="width:"+memorywidth+";height:"+memoryheight+";"
to:
Code:
var combinedcssTable="width:100%;background-color:"+memorybgcolor+";padding:"+memorypadding+";"+borderCSS+";"
var combinedcss="width:100% ;height:"+memoryheight+";"
to get it to become 100% width wise.

Last edited by ddadmin; 02-09-2008 at 07:42 AM.
Reply With Quote
  #3  
Old 02-09-2008, 07:32 AM
PZ5413 PZ5413 is offline
Junior Coders
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't see any difference between those two... I think they're exactly the same lol.

Didn't work btw. :-)
Reply With Quote
  #4  
Old 02-09-2008, 07:42 AM
ddadmin's Avatar
ddadmin ddadmin is offline
Administrator
 
Join Date: Aug 2004
Posts: 7,627
Thanks: 2
Thanked 639 Times in 629 Posts
Blog Entries: 13
Default

Ops, going senile. Fixed.
Reply With Quote
  #5  
Old 02-09-2008, 08:06 AM
PZ5413 PZ5413 is offline
Junior Coders
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Awesome.. only a slight problem now, if ya check it out... the scroller stops once the end of the text completes... and thats it... lol. Also, it doesn't start at the beginning either. Would it be easier to implement a 100% scroll ticker type thing with the Cross Browser Marquee instead of the Memory Scroller?

Also, no prob with the senile thing... before I tried the same code you just gave me and it didn't work. I forgot that I put a wrap around it to center the 1000px scroller and the wrap was set to 1000px as well lol. I fixed that now and I'm stuck with the problem above.
Reply With Quote
  #6  
Old 02-09-2008, 06:28 PM
PZ5413 PZ5413 is offline
Junior Coders
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

With ill attempts at getting any tickers to stretch 100%, I've decided to go with the ESPN Bottomline ticker for now.

If anyone can configure a way to get either the Memory Scroller or Cross Browser Marquee scripts to stretch 100% and still work properly that'd be great! Thanks!
Reply With Quote
  #7  
Old 02-09-2008, 07:09 PM
ddadmin's Avatar
ddadmin ddadmin is offline
Administrator
 
Join Date: Aug 2004
Posts: 7,627
Thanks: 2
Thanked 639 Times in 629 Posts
Blog Entries: 13
Default

Actually, I don't get the problem with the scroller stopping once it's done with the 1st cycle. I do see the problem with the scroller not starting from the very beginning on subsequent cycles though.

The below modified script includes the original changes, plus the fix for the later problem mentioned above:

Code:
<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 memorywidth="100%"
var memoryheight="20px" //scroller height
var memorybgcolor="#DEFDD9" //scroller background
var memorypadding="2px" //padding applied to the scroller. 0 for non.
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='<nobr><span style="font: bold 13px Verdana">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> 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.</span></nobr>'


////NO NEED TO EDIT BELOW THIS LINE////////////
var combinedcssTable="width:100%;background-color:"+memorybgcolor+";padding:"+memorypadding+";"+borderCSS+";"
var combinedcss="width:100% ;height:"+memoryheight+";"

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('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-10000px">'+memorycontent+'</span>')
var actualwidth=''
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.left=parseInt(memorywidth)+8+"px"
if (persistlastviewedmsg && get_cookie("lastscrollerpos")!="")
revivelastmsg()
memoryscroller.innerHTML=memorycontent
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
lefttime=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.left
}

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

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

function scrollmarquee(){
if (parseInt(memoryscroller.style.left)>(actualwidth*(-1)+8))
memoryscroller.style.left=parseInt(memoryscroller.style.left)-copyspeed+"px"
else
memoryscroller.style.left=document.getElementById('memorytable').offsetWidth+8+'px'
}

if (iedom){
with (document){
document.write('<table id="memorytable" 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;left:0px;top:0px;" '+divonclick+'></div>')
write('</div>')
document.write('</td></table>')
}
}
</script>
Reply With Quote
  #8  
Old 02-09-2008, 07:23 PM
PZ5413 PZ5413 is offline
Junior Coders
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Awesome, it works perfectly. Thank you for all your help.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:40 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.