Ok, así que estoy haciendo un guión que, o bien se desplazará a través de una serie de divs o sólo 4 elementos en un momento cuando el usuario hace clic en uno "para arriba / flecha hacia abajo", aunque ahora soy establecidos en hacer que se desplace divs. He comenzado a escribir un guión, pero no soy muy familiar con javascript y no saben a dónde ir desde allí. Con la esperanza de que alguien aquí me puede ayudar de alguna manera.
Esto es lo que empecé a trabajar en.
var divScroll = [];
divScroll[0] = document.getElementById('i1t5');
divScroll[1] = document.getElementById('16t10');
divScroll[2] = document.getElementById('i11t15');
function click()
{
if (document.getElementById('arrowUp'))
{
for (int i = 0; i < divScroll.length; i--)
{
document.getElementById('leftScroll');
}
}
if (document.getElementById('arrowDown'))
{
for (int i = 0; i < divScroll.size(); i++)
{
}
}
}
- var divScroll = [];
- divScroll[0] = document.getElementById('i1t5');
- divScroll[1] = document.getElementById('16t10');
- divScroll[2] = document.getElementById('i11t15');
-
- function click()
- {
- if (document.getElementById('arrowUp'))
- {
- for (int i = 0; i < divScroll.length; i--)
- {
- document.getElementById('leftScroll');
-
- }
- }
- if (document.getElementById('arrowDown'))
- {
- for (int i = 0; i < divScroll.size(); i++)
- {
-
- }
- }
- }
Y encontré esta línea que probablemente me daría un "desplazamiento" efecto cuando se hace clic.
scrollStep=1
timerUp=""
timerDown=""
function toTop(id){
document.getElementById(id).scrollTop=0
}
function scrollDivDown(id){
clearTimeout(timerDown)
document.getElementById(id).scrollTop+=scrollStep
timerDown=setTimeout("scrollDivDown('"+id+"')",10)
}
function scrollDivUp(id){
clearTimeout(timerUp)
document.getElementById(id).scrollTop-=scrollStep
timerUp=setTimeout("scrollDivUp('"+id+"')",10)
}
function toBottom(id){
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}
function stopMe(){
clearTimeout(timerDown)
clearTimeout(timerUp)
}
- scrollStep=1
-
- timerUp=""
- timerDown=""
-
- function toTop(id){
- document.getElementById(id).scrollTop=0
- }
-
- function scrollDivDown(id){
- clearTimeout(timerDown)
- document.getElementById(id).scrollTop+=scrollStep
- timerDown=setTimeout("scrollDivDown('"+id+"')",10)
- }
-
- function scrollDivUp(id){
- clearTimeout(timerUp)
- document.getElementById(id).scrollTop-=scrollStep
- timerUp=setTimeout("scrollDivUp('"+id+"')",10)
- }
-
- function toBottom(id){
- document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
- }
-
- function stopMe(){
- clearTimeout(timerDown)
- clearTimeout(timerUp)
- }
Cualquier tipo de ayuda se agradece, opiniones, consejos, trucos, todo lo que le ayudará.