PDA

View Full Version : Site Logo Script.. no clue why..



iblob
04-15-2006, 04:11 AM
Script: Site Logo Script (a.k.a Geocities Watermark)
http://dynamicdrive.com/dynamicindex4/logo.htm

Okay this makes no sence to me.

I have setup the Site Logo Script at http://www.littlejohnscastle.com/index5.htm

I did everything exactly how the page tells me too, I even looked at the source code of the page to make sure everything was the same. But it just does not work!

So I got curious and took the exact code that dynamic drive has on the page, copied it and pasted it into a new page, then uploaded it, and guess what.... it works! Go figure.

Here is the test page for that: http://www.littlejohnscastle.com/test.htm

So if someone could help me out it would be great! (probly something stupid :p)

jscheuer1
04-15-2006, 05:55 AM
That script will not work with a DOCTYPE. I did update it, but this one is better (just configure, save it to a file say - jlogo.js and put this:


<script src="jlogo.js" type="text/javascript"></script>

just above your closing </body> tag.



/*
Floating Logo script - adapted from Roy Whittle's Floating Menu (http://www.javascript-fx.com/)
by jscheuer1
This notice must stay intact for use
*/


//Set Variables
var logoaltxt='MakeupTalk' /*Alternate Text for Logo*/
var logolink='http://makeuptalk.com' /*Logo's Link, use empty quotes '' for none*/
var logoimage='http://www.makeuptalk.com/images/dynamic2.gif' /*Image used for Logo*/
var logowidth=130 /*Logo Image's Width*/
var logoheight=40 /*Logo Image's Height*/
var beginLogo=100 /*Set to Vertical Scrolling Start point, -1 for visible from start.*/
var endlogo='yes' /*Set to 'no' for logo that remains visible after initial start,
'yes' for logo that disappears when begin point is returned to,
or lowerLimit is reached.*/

var lowerLimit=0 /*Set to Vertical Scrolling End point, 0 for no end point. Must be
greater than combined beginLogo, logoheight and Voffset to have
any effect and endLogo must be set to 'yes'*/

var Hoffset=20 /*Optional Horizontal and Vertical Offsets*/
var Voffset=10 /*Change only if you do not like the defaults*/

///////////////No Need to EDIT Below Here////////////////
if (lowerLimit==0||lowerLimit<=beginLogo+logoheight+Voffset)
lowerLimit=Number.POSITIVE_INFINITY
if (!document.layers)
document.write('<div id="watermarklogo" style="position:absolute;display:none;z-index:100">')
if (document.layers)
document.write('<layer id="watermarklogo">')
if (logolink!=='')
document.write('<a href="'+logolink+'">')
document.write('<img src="'+logoimage+'" border="0" width="'+logowidth+'" height="'+logoheight+'" alt="'+logoaltxt+'">')
if (logolink!=='')
document.write('</a>')
if (document.layers)
document.write('</layer>')
if (!document.layers)
document.write('</div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var el

function JSFX_FloatTopDiv()
{
var pix = document.layers? '' : 'px'
var startX = ie? logowidth+Hoffset : logowidth+Hoffset+20;
var startY = ie? logoheight+Voffset : logoheight+Voffset+20;
var d = document;
function ml(id)
{
el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+pix;this.style.top=y+pix;};
el.y = ie ? iecompattest().scrollTop + iecompattest().clientHeight : pageYOffset + innerHeight;
el.y -= startY;
el.x = ie ? iecompattest().scrollLeft + iecompattest().clientWidth : pageXOffset + innerWidth;
el.x -= startX;
return el;
}
window.positionIt=function()
{
var tempTop = ie ? iecompattest().scrollTop : pageYOffset;
if (endlogo=='yes'&&(beginLogo>tempTop||lowerLimit<tempTop)){
el.style.display='none'
clearTimeout(nub)
slideChk=0
i = (ie)? -5 : 10
initCheck=setInterval("slideUpCheck()",50)
return;}
var pY = ie ? iecompattest().scrollTop + iecompattest().clientHeight : pageYOffset + innerHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
var pX = ie ? iecompattest().scrollLeft + iecompattest().clientWidth : pageXOffset + innerWidth;
ftlObj.x += (pX - startX - ftlObj.x)/8;
ftlObj.sP(ftlObj.x, ftlObj.y);
var nub = setTimeout("positionIt()", 20);
}
ftlObj = ml("watermarklogo");
positionIt();
}

var i = (ie)? -5 : 10
function slideUp(){
i+=1
var watermark_obj=ie? document.all.watermarklogo : document.getElementById? document.getElementById("watermarklogo") : document.watermarklogo
var dsocleft=ie? iecompattest().scrollLeft : pageXOffset
var dsoctop=ie? iecompattest().scrollTop : pageYOffset
var window_width=ie? iecompattest().clientWidth : window.innerWidth-20
var window_height=ie? iecompattest().clientHeight : window.innerHeight

if (ie||document.getElementById){
watermark_obj.style.left=parseInt(dsocleft)+parseInt(window_width)-logowidth-Hoffset+'px'
watermark_obj.style.top=parseInt(dsoctop)+parseInt(window_height)-i-Voffset+'px'
watermark_obj.style.display='inline'
}
else if (document.layers){
watermark_obj.left=dsocleft+window_width-Hoffset-logowidth
watermark_obj.top=dsoctop+window_height-i-Voffset
}
var sliding=setTimeout("slideUp()",50)
var logolim = (ie)? logoheight : logoheight+20
if (i==logolim){
clearTimeout(sliding)
JSFX_FloatTopDiv()
return;
}
}

var slideChk=0
function slideUpCheck(){
var dsoctop=ie? iecompattest().scrollTop : pageYOffset
if (dsoctop>beginLogo&&dsoctop<lowerLimit){
if (slideChk==0){
slideChk=1;
slideUp()
clearInterval(initCheck)
}
}
}

if (ie||document.getElementById||document.layers)
var initCheck=setInterval("slideUpCheck()",50)