Normal
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example HTML5 Document Example</title>
</head>
<body>
<p>Test</p>
</body>
</html>
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example HTML5 Document Example</title>
</head>
<body>
<p>Test</p>
</body>
</html>
Javascript
$(window).scroll(function(){
if($(window).scrollTop()>300){
$('#totoc').fadeIn(250);
}else{
$('#totoc').fadeOut(250);
};
});