Reputation: 133
I am trying to get an image to be able to be zoom in on when you scroll the mouse wheel. I'm using jQuery.mousewheel.min to execute this function but no matter I do I get this error in the console
Uncaught TypeError: $(...).mousewheel is not a function
here is a code sample
<script type="text/javascript">
$(document).ready(function() {
$(document).mousewheel(function(event, delta) {
setYPos(delta);
so basically i'm asking if someone could help me troubleshoot this problem could it maybe be one of these inter fairing with it.
<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">
Upvotes: 4
Views: 9184
Reputation: 1176
$.mousewheel is not part of the jQuery API.
http://api.jquery.com/?s=mouse
For what it sounds like you're trying to do, you need to use a more specific selector, catch the scroll, read the direction and distance, and prevent default so it doesn't scroll the window -
$('img').on('scroll', function(e) { e.preventDefault(); // do some stuff });
Upvotes: 2