freshboy Posted November 9, 2005 Share Posted November 9, 2005 http://www.sunrisevietnam.com/index.phpthis is a php page but i wonder that it may be done by using javascriptplease go there and help me to find out how they do it.How they make the green small icon on the right-bottom corner of screen move when you scroll the page.....Please help me, i am very passionate about WEB design.thank you so much. Link to comment Share on other sites More sharing options...
alwaysvaghu Posted November 9, 2005 Share Posted November 9, 2005 hi..i think the page contain little php code..that is why the extension is .php..otherwise most of the thing is done in javascript...u see the code u will find this kid of code which says that it uses javascript and CSS <script src="includes/js/default_js.js" language="Javascript"></script><script src="templates/acidgreen/ypSlideOutMenusC.js" type="" language="JavaScript"></script><script src="templates/acidgreen/bgsleight.js" type="" language="JavaScript"></script><script src="templates/acidgreen/slider_home.js" type="" language="JavaScript"></script><style type="text/css" media="all">@import url("templates/acidgreen/default.css");</style><style type="text/css" media="all">@import url("templates/acidgreen/home.css");</style> Link to comment Share on other sites More sharing options...
MadPotato Posted November 9, 2005 Share Posted November 9, 2005 first, they use a small code to verify if the DOM (see w3schools.com to learn about it) of the browser can handle Layers, <script type="text/javascript">if (!document.layers)document.write('<div id="divStayTopLeft" style="position:absolute">')</script> then they used the following script to do the magic: <script type="text/javascript"> /* Floating Menu script- Roy Whittle (http://www.javascript-fx.com/) Script featured on/available at http://www.dynamicdrive.com/ This notice must stay intact for use */ //Enter "frombottom" or "fromtop" var verticalpos="frombottom" if (!document.layers) document.write('</div>') function JSFX_FloatTopDiv() { var startX = document.body.clientWidth - 30, startY = 92; var ns = (navigator.appName.indexOf("Netscape") != -1); var d = document; function ml(id) { var 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;this.style.top=y;}; el.x = startX; if (verticalpos=="fromtop") el.y = startY; else{ el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight; el.y -= startY; } return el; } window.stayTopLeft=function() { if (verticalpos=="fromtop"){ var pY = ns ? pageYOffset : document.body.scrollTop; ftlObj.y += (pY + startY - ftlObj.y)/8; } else{ var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight; ftlObj.y += (pY - startY - ftlObj.y)/8; } ftlObj.sP(ftlObj.x, ftlObj.y); setTimeout("stayTopLeft()", 10); } ftlObj = ml("divStayTopLeft"); stayTopLeft(); } JSFX_FloatTopDiv(); </script> good luck hope i helped Link to comment Share on other sites More sharing options...
MadPotato Posted November 9, 2005 Share Posted November 9, 2005 as you noticed, theres a link to the script in the coments of the second code i posted...i didn't entered it, and also i didn't tested the script, just separated it from the rest of the code there, so good luck Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now