Плавная Прокрутка(стрелки вверх и вниз)
Добавлено: 15 мар 2013, 09:28
Впринципе все верно, тем более если все адекватно работает
Неформальная поддержка форумов phpBB
https://www.hello-vitebsk.ru/
Код: Выделить всё
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Код: Выделить всё
<script type="text/javascript">
jQuery(function(){
$("#Go_Top").hide().removeAttr("href");
if ($(window).scrollTop()>="250") $("#Go_Top").fadeIn("slow")
$(window).scroll(function(){
if ($(window).scrollTop()<="250") $("#Go_Top").fadeOut("slow")
else $("#Go_Top").fadeIn("slow")
});
$("#Go_Bottom").hide().removeAttr("href");
if ($(window).scrollTop()<=$(document).height()-"999") $("#Go_Bottom").fadeIn("slow")
$(window).scroll(function(){
if ($(window).scrollTop()>=$(document).height()-"999") $("#Go_Bottom").fadeOut("slow")
else $("#Go_Bottom").fadeIn("slow")
});
$("#Go_Top").click(function(){
$("html, body").animate({scrollTop:0},"slow")
})
$("#Go_Bottom").click(function(){
$("html, body").animate({scrollTop:$(document).height()},"slow")
})
});
</script>
Код: Выделить всё
<a style='position: fixed; bottom: 128px; right: 2px; cursor:pointer; display:none;'href='#' id='Go_Top'><img src="http://сайт.ru/images/go_up.png" alt="Наверх" title="Наверх"></a>
<a style='position: fixed; bottom: 60px; right: 1px; cursor:pointer; display:none;'href='#' id='Go_Bottom'><img src="http://сайт.ru/images/go_bottom.png" alt="Вниз" title="Вниз"></a>