A-J Posted November 10, 2009 Report Share Posted November 10, 2009 (edited) Hola! Les traigo un codigo que hace que puedan subir más ligeramente, este codigo hace que puedan subir en forma de ascensor en su web. Si quieres ver un ejemplo haz click aqui y haz click en el icono ubicado abajo a la derecha. Codigo: Poner esto entre las etiquetas <head>y </head> <script type="text/javascript"> (function() { function $(id) { return document.getElementById(id); } function setStyleDisplay(id, status) { $(id).style.display = status; } function goTop(acceleration, time) { acceleration = acceleration || 0.1; time = time || 16; var dx = 0; var dy = 0; var bx = 0; var by = 0; var wx = 0; var wy = 0; if (document.documentElement) { dx = document.documentElement.scrollLeft || 0; dy = document.documentElement.scrollTop || 0; } if (document.body) { bx = document.body.scrollLeft || 0; by = document.body.scrollTop || 0; } var wx = window.scrollX || 0; var wy = window.scrollY || 0; var x = Math.max(wx, Math.max(bx, dx)); var y = Math.max(wy, Math.max(by, dy)); var speed = 1 + acceleration; window.scrollTo(Math.floor(x / speed), Math.floor(y / speed)); if(x > 0 || y > 0) { var invokeFunction = "MGJS.goTop(" + acceleration + ", " + time + ")" window.setTimeout(invokeFunction, time); } } function switchTab(showPanels, hidePanels, activeTab, activeClass, fadeTab, fadeClass) { $(activeTab).className = activeClass; $(fadeTab).className = fadeClass; var panel, panelList; panelList = showPanels.split(','); for (var i = 0; i < panelList.length; i++) { var panel = panelList[i]; if ($(panel)) { setStyleDisplay(panel, 'block'); } } panelList = hidePanels.split(','); for (var i = 0; i < panelList.length; i++) { panel = panelList[i]; if ($(panel)) { setStyleDisplay(panel, 'none'); } } } window['MGJS'] = {}; window['MGJS']['$'] = $; window['MGJS']['setStyleDisplay'] = setStyleDisplay; window['MGJS']['goTop'] = goTop; window['MGJS']['switchTab'] = switchTab; })(); function switchImage(imageId, imageUrl, linkId, linkUrl, preview, title, alt) { if(imageId && imageUrl) { var image = $(imageId); image.src = imageUrl; if(title) { image.title = title; } if(alt) { image.alt = alt; } } if(linkId && linkUrl) { var link = $(linkId); link.href = linkUrl; } } </script> Y esto pongalo entre <body> y </body> <!-- www.cssplantilla.es.tl --> <a id="gotop" onclick="MGJS.goTop();return false;" href="/home.htm" title="Subir" style='display:scroll;position:fixed;bottom:10px;left:5px;'><img src="http://cssplantillas.netau.net/ap/archivos/f9e1950d4f.png" border="0"/></a> Espero que les sirva! PD: No es un code PHP sino un javascript. Saludos! ;) Edited November 10, 2009 by A-J Link to comment Share on other sites More sharing options...
Aljacer Posted January 4, 2010 Report Share Posted January 4, 2010 ta piola...se agradece. Link to comment Share on other sites More sharing options...
The_mastersok Posted January 12, 2010 Report Share Posted January 12, 2010 esta super bueno el aporte... gracias!!! Link to comment Share on other sites More sharing options...
HOOLIGAN1989 Posted December 12, 2011 Report Share Posted December 12, 2011 muy bueno el aporte lo andaba buscando desde que lo vi en (Palabra Censurada, está prohibido el SPAM) .... gracias !! :D Link to comment Share on other sites More sharing options...
chuncho_villero Posted January 19, 2012 Report Share Posted January 19, 2012 Para esto es mejor usar scrollTo con jquery les dejo un ejemplo de la pagina que hice yo con esta animacione http://ancestrate.webuda.com/ aca les dejo de donde pueden sacar el codigo http://masquewordpress.com/ejemplos/scroll-con-jquery/ Link to comment Share on other sites More sharing options...
Andurat Posted August 8, 2012 Report Share Posted August 8, 2012 si es bueno ese efecto!!! Link to comment Share on other sites More sharing options...
roberto1982 Posted May 9, 2013 Report Share Posted May 9, 2013 Vamos a probar que tal. Slds! 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