PDA

View Full Version : Watermark to scroll horizontal instead of verticle; help!


kopertone1
09-06-2008, 08:52 PM
Trying to have the water mark follow my scroll horizontally instead of the typical veritcal method. How would i adjust the code below to make that work?

<Script Language=JavaScript>
//--- Begin Customizations ---------
var pctTop = "3%";
var pctRight = "3%";
var imageIs = "images/black_flowers_logo.gif"; // put path and file name here
var nRight = 0;
var nbottom = 0;
//--- End Customizations -----------

var absStr = "Position:Absolute;bottom:"+pctTop+";Right:"+pctRight+"";

function stayHome(){

iL = document.body.scrollReft;
iV = document.body.scrollbottom;
isFloat.style.Right = iL+nRight;
isFloat.style.bottom = iV+nbottom;
}

window.onscroll = stayHome;

function insertFloatIMG(){

styleStr = "<Style>.imgFloat {"+absStr+";Border-Style:Solid;Border-Width:1px;Padding-Top:20px;Padding-Right:20px;Padding-Bottom:20px;Padding-Left:20px;Margin-Left:0px;Margin-Right:0px;Margin-Top:0px;Margin-Bottom:0px;Background-Color:Blue;Text-Indent:0px;}</Style>";

divStr = "<DIV class=imgFloat id=isFloat><input type=image src=null id=fIMG alt='Describe the Image'></DIV>"

document.write(styleStr);
document.write(divStr);
fIMG.src = imageIs;
nLeft = isFloat.offsetRight;
nTop = isFloat.offsetbottom;
}

</Script>

BillR
09-06-2008, 10:05 PM
kopertone1,

I have a watermark image that I made using a graphics program and reduced the opacity. Then I used css to place it in the center of the browser window. It remains centered in most browsers, and I can't worry about IE6.

The CSS I use is:

background-image: url('/img/mark.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center center;


That is not javascript, but it is simple and may do what you want done.