»
EnglishFrenchVietnamese

Print - Logo Fader - JavaScriptBank.com

Full version: jsB@nk » Image » Logo Fader
URL: https://www.javascriptbank.com/logo-fader.html

Logo Fader © JavaScriptBank.comFade any image horizontally and vertically. Can be positioned anywhere on the page. Awesome!

Full version: jsB@nk » Image » Logo Fader
URL: https://www.javascriptbank.com/logo-fader.html



JavaScript
<script language="JavaScript1.2">/* Original:  Bob Simpson (webmaster@maryjanebrown.net)Web Site:  http://www.maryjanebrown.net/webmaster*/<!-- Beginfunction BrowserCheck() {var b = navigator.appName;if (b == "Netscape") this.b = "NS";else if (b == "Microsoft Internet Explorer") this.b = "IE";else this.b = b;this.v = parseInt(navigator.appVersion);this.NS = (this.b == "NS" && this.v >= 4);this.NS4 = (this.b == "NS" && this.v == 4);this.NS5 = (this.b == "NS" && this.v == 5);this.IE = (this.b == "IE" && this.v >= 4);this.IE4 = (navigator.userAgent.indexOf('MSIE 4') > 0);this.IE5 = (navigator.userAgent.indexOf('MSIE 5') > 0);if (this.IE5 || this.NS5) this.VER5 = true;if (this.IE4 || this.NS4) this.VER4 = true;this.oldVer = (! this.VER5 && ! this.VER4) ? true : false;this.min = (this.NS || this.IE);}is = new BrowserCheck()var myLogo = (is.NS4) ? document.layers["logo"] : document.all["logo"].style;var logoWidth = (is.NS4) ? document.logo.document.logoIm.width : document.logoIm.width;var logoHeight = (is.NS4) ? document.logo.document.logoIm.height : document.logoIm.height;var halfHeight = logoHeight / 2;var windowWidth = (is.NS4) ? window.innerWidth - 16 : document.body.offsetWidth - 20;var halfWidth = logoWidth / 2;var cliplogoHeightor = (is.NS4) ? 'myLogo.clip.top = 0;' +'myLogo.clip.right = right;' +'myLogo.clip.bottom = logoHeight;' +'myLogo.clip.left = left; ':'str="rect(0 " + right + " " + logoHeight + " " + left + ")";' +'myLogo.clip = str; 'var clipLogoVert = (is.NS4) ? 'myLogo.clip.top = up;' +'myLogo.clip.right = logoWidth;' +'myLogo.clip.bottom = dn;' +'myLogo.clip.left = 0; ':'str="rect(" + up + " " + logoWidth + " " + dn + " 0)";' +'myLogo.clip = str;'var right = logoWidth, left = 0;var cnt = 0, up = halfHeight, dn = halfHeight, upDown;var logoWidth, logoHeight;// ---------------  User modifiable variables  ----------------------//if useAnchorPosition is true logo will be positioned where you put the "logoAnchor"//set to false to center logo - also set myLogo.top to desired positionvar useAnchorPosition = false; // set to false to set your own logo position belowif (! useAnchorPosition) {myLogo.left = ((windowWidth / 2) - (logoWidth / 2)); // centers logo - comment out if using line below//myLogo.left = 100; // remove '//' to set left positionmyLogo.top = 260; // sets logo top}var scrollInc = 5;// sets # of pixels to scroll in 1 time framevar scrollSpeed = 10;// sets the scroll speed// ------------------------------------------------------------------function scrollLogo() {if (cnt == 0) {up-- ; dn++;if (up < -10) {right = logoWidth;left = 0;upDown = -scrollInc;cnt++;}eval(clipLogoVert);}if (cnt == 1) {right +=  upDown;left -= upDown;if (right < halfWidth-40) {right = halfWidth;left = halfWidth;upDown = scrollInc;cnt++;}eval(cliplogoHeightor);}if (cnt == 2) {right +=  upDown;left -= upDown;if (right > logoWidth+20) {right = logoWidth;left = 0;up = 0;dn = logoHeight;cnt++;}eval(cliplogoHeightor);}if (cnt == 3) {up++;dn--;if (dn < halfHeight - 10) {up = halfHeight;dn = halfHeight;right = logoWidth;left = 0;upDown = scrollInc;cnt = 0;}eval(clipLogoVert)}setTimeout("scrollLogo()", scrollSpeed);}if (! is.oldVer)window.onload = init;function init() {positionLogo();scrollLogo();}var L, T;var pos = (is.NS4) ? pos = document.anchors['logoAnchor'] : document.all['logoAnchor'];var posStr = (is.NS4) ?  'L = pos.x ; T = pos.y' : 'L = pos.offsetLeft; T = pos.offsetTop';function positionLogo() {if (! useAnchorPosition) return;eval(posStr);myLogo.top = T;myLogo.left = L;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload="scrollLogo()"><a name="logoAnchor"></a><div id="logo" style="position: absolute; visibility: visible;"><img name="logoIm" src="logojs.gif" width="150" height="60"></div></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->