Code: Select all
window.scroll (0.0);
<script>
window.onload=function (){
var top=document.getElementByID ('top');
top.onclick=window.scroll() {window.scrollTo (0.0);}
}
</script>
Code: Select all
window.scroll (0.0);
<script>
window.onload=function (){
var top=document.getElementByID ('top');
top.onclick=window.scroll() {window.scrollTo (0.0);}
}
</script>
Code: Select all
$(document).ready(function(){
/* Scroll to top link (.go-to-top) */
/* Check to see if the window is top if not then display button */
$(window).scroll(function(){
if ($(this).scrollTop() > 200) {
$('.go-to-top').fadeIn();
} else {
$('.go-to-top').fadeOut();
}
});
/* Click event to scroll to top */
$('.go-to-top').click(function(){
/* adjust speed - lower value faster */
$('html, body').animate({scrollTop: 0}, 300);
return false;
});
});Code: Select all
<a class="go-to-top" href="#">Top</a>Code: Select all
a.go-to-top
{
position: fixed;
bottom: 0;
right: 0;
padding: 0.6em;
background-color: #CA2A60;
color: #ffffff;
display: none; /* displayed using script */
opacity: 0.75;
}
a.go-to-top:hover,
a.go-to-top:focus
{
background-color: #A90163;
text-decoration: none;
opacity: 1;
}Code: Select all
$(window).scroll(function(){
if ($(this).scrollTop() > 50) {
$('.title-bar.tab-bar').addClass('fixed');
} else {
$('.title-bar.tab-bar').removeClass('fixed');
}
});