Get started with ScrollToFixed CDN
MIT licensed
ScrollToFixed is a jQuery plugin that allows fixed positioning of an element while scrolling.
Tags:- scroll
- fixed
- jquery
Stable version
Copied!
How to start using ScrollToFixed CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with ScrollToFixed CDN - cdnhub.io</title>
<link rel="stylesheet" href="styles.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.cdnhub.io/ScrollToFixed/1.0.8/jquery-scrolltofixed-min.js"></script>
<script>
$(document).ready(function() {
$('.element').scrollToFixed();
});
</script>
<style>
.element {
position: fixed;
top: 0;
width: 100%;
background-color: #f5f5f5;
padding: 20px;
}
</style>
</head>
<body>
<div class="element">
<h1>Fixed Element</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc quis viverra rhoncus, tellus nisi bibendum arcu, vel aliquet velit nisi quis nibh. Nullam id felis et ipsum bibendum ultrices.</p>
</div>
<div id="content">
<h2>Scrollable Content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc quis viverra rhoncus, tellus nisi bibendum arcu, vel aliquet velit nisi quis nibh. Nullam id felis et ipsum bibendum ultrices.</p>
</div>
</body>
</html>
Copied!
Copied!