Get started with jquery-mousewheel CDN
MIT licensed
JQuery Mousewheel: advanced scrolling, mouse wheel and touch gestures.
Tags:- browser
- event
- jquery
- mouse
- mousewheel
- plugin
- wheel
Stable version
Copied!
How to start using jquery-mousewheel CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with jquery-mousewheel 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/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<div id="scroll-box">
<p>Scroll me horizontally or vertically using the mouse wheel:</p>
</div>
</body>
</html>
// script.js
$(function() {
$('#scroll-box').mousewheel(function(event, delta) {
this.scrollLeft += (event.deltaX || event.originalEvent.deltaX) * 10;
this.scrollTop += (event.deltaY || event.originalEvent.deltaY) * 10;
event.preventDefault();
});
});
Copied!
Copied!