Scroll Detection

Size
2,186 Kb
Views
10,120

How do I make an scroll detection?

What is a scroll detection? How do you make a scroll detection? This script and codes were developed by David Bellotti on 30 October 2022, Sunday.

Scroll Detection Previews

Scroll Detection - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Scroll Detection</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <center> <h1 class="info"> thing </h1>
</center> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Scroll Detection - Script Codes CSS Codes

center { background-color: black; height: 101vh; width: 100vw;
}
.info { color: red; position: absolute; top: 50%; left: 50%; -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%);
}

Scroll Detection - Script Codes JS Codes

var pos = 0;
$(window).scroll(function(e) { var currentPos = $(this).scrollTop(); if (currentPos <= pos) { $(".info").text("down"); } else if (currentPos > pos) { $(".info").text("up"); } e.preventDefault(); return false;
});
Scroll Detection - Script Codes
Scroll Detection - Script Codes
Home Page Home
Developer David Bellotti
Username dbellotti
Uploaded October 30, 2022
Rating 3
Size 2,186 Kb
Views 10,120
Do you need developer help for Scroll Detection?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

David Bellotti (dbellotti) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!