Transparent DHTML scroll

They have: 383 posts

Joined: Sep 2000

I'm using one of those DHTML text scrollers from Dynamic Drive. However I need to make it transparent rather then apply a background color.

myScroller1.setPause(2000);
myScroller1.setColors("#000000", "", "");

I've tried keeping the variables blank however it doesn't work in Netscape. I know I've done it before on another project. Any ideas? I'm using an image as a placeholder and need the text to scroll over it.

detox's picture

They have: 571 posts

Joined: Feb 2001

when you leave the set colors blank do you get a default color or something on NN?

They have: 383 posts

Joined: Sep 2000

I'm getting a JavaScript error. Basically the error states that there is no color set for the div. Works fine in IE of course Smiling

<script language=JavaScript src="js/dhtmllib.js"></script>
<script language=JavaScript src="js/scroller.js"></script>
<script language=JavaScript>

var myScroller1 = new Scroller(0, 0, 28, 100, 0, 4);
myScroller1.addItem("Item One");
myScroller1.addItem("Item Two");
myScroller1.addItem("Item Three");
myScroller1.setSpeed(75);
myScroller1.setPause(2000);
myScroller1.setColors("#000000", "#", "#"); -->

function init() {
var img;
var x, y;

img = getImage("placeholder");
x = getImagePageLeft(img);
y = getImagePageTop(img);

myScroller1.create();
myScroller1.hide();
myScroller1.moveTo(x, y);
myScroller1.setzIndex(100);
myScroller1.show();

}

window.onload=init

</script>

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

and if you just say 'transparent' in the SetColors?

They have: 383 posts

Joined: Sep 2000

I tried setting it to transparent. However it shows up fine in IE and shows up with a blue background in NS.

They have: 383 posts

Joined: Sep 2000

Well, I figured it out. I had to switch the layer.bgColor = color; to layer.bgColor = null; in the dhtmllib.js file.

//-----------------------------------------------------------------------------
// Layer background.
//-----------------------------------------------------------------------------

function setBgColor(layer, color) {

if (isMinNS4)
layer.bgColor = null;
if (isMinIE4)
layer.style.backgroundColor = null;
}

function setBgImage(layer, src) {

if (isMinNS4)
layer.background.src = src;
if (isMinIE4)
layer.style.backgroundImage = "url(" + src + ")";
}

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.