Invalid type Error mousewheel is not a function
I am trying to get an image so that I can zoom in on my mouse wheel scrolling. I am using jQuery.mousewheel.min to do this function, but no matter what I do I get this error in the console
Uncaught TypeError: $ (...). mousewheel is not a function
here is a sample code
<script type="text/javascript">
$(document).ready(function() {
$(document).mousewheel(function(event, delta) {
setYPos(delta);
so basically I am asking if anyone can help me fix this problem maybe it could be one of these mutual fairings.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="kinetic-v5.1.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="jquery.mousewheel.min.js" type="text/javascript"></script>
<link href="easy-sidebar.css" rel="stylesheet" type="text/css">
source to share
$. mousewheel is not part of the jQuery API.
http://api.jquery.com/?s=mouse
It looks like you are trying to do this, you need to use a more specific selector, catch the scroll, read the direction and distance, and prevent it by default from scrolling the window -
$('img').on('scroll', function(e) { e.preventDefault(); // do some stuff });
source to share