hi
I want when users scroll down it will appear button that when users click on it will go up to the page but it doesn't work.
below are codes.
<head runat="server">
<title></title>
<style>
.scrollToTop{
width:100px;
height:130px;
padding:10px;
text-align:center;
background: whiteSmoke;
font-weight: bold;
color: #444;
text-decoration: none;
position:fixed;
top:75px;
right:40px;
display:none;
background: url('arrow_up.png') no-repeat 0px 20px;
}
.scrollToTop:hover{
text-decoration:none;
}
#main {
width:100%;
height:2000px;
border:1px solid red;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="main">
<a href="#" class="scrollToTop">Scroll To Top</a>
</div>
</form>
</body>
</html>
Best regards
Neda