H
hamiltonbl
Eta
Hola, Tengo un problema pues estoy haciendo scroll de una seccion a otra....
Mi html
y mi js
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
algo de css
Al darle clic efectivamente me hace el scroll, pero el efecto es muy ofensivo, muy rapido... Querio darle un efecto lento pero no funciona.. Alguien que me eche una mano.. Please.
Mi html
Inserir CODE, HTML ou PHP:
<a id="up" href="#down">down</a><div class="up"></div>
<a id="down" href="#up">up</a>
<div class="down"></div>
y mi js
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
Inserir CODE, HTML ou PHP:
$('#up, #down').on('click', function(e){ e.preventDefault();
var target= $(this).get(0).id == 'up' ? $('#down') : $('#up');
$('html, body').stop().animate({
scrollTop: target.offset().top
}, 1000);
});
algo de css
Inserir CODE, HTML ou PHP:
.up { width:100px;
height: 600px;
background-color: red;
}
.down {
width:100px;
height: 400px;
background-color: yellow;
}
Al darle clic efectivamente me hace el scroll, pero el efecto es muy ofensivo, muy rapido... Querio darle un efecto lento pero no funciona.. Alguien que me eche una mano.. Please.