Wheelzoom: zooming IMG elements with the mousewheel/trackpad.

jQuery Wheelzoom is a small plugin for zooming IMG elements with the mousewheel/trackpad.

Wheelzoom works by scaling and positioning a background-image, after it sets the IMG element’s src to a transparent png.

Wheelzoom doesn’t add any extra elements to the DOM, or change the positioning of the IMG element.

Wheelzoom doesn’t change the DOM. It works by sizing and positioning background-size and background-position styles.

Wheelzoom replaces an img’s background-image with it’s src. Then the src is set to a transparent PNG. The benefit to using a background-image is that plugin does not change the DOM or the positioning of the img element. This means that the plugin should just work regardless of your specific CSS or markup. The drawback that there is no support for background-sizing in older browsers (IE8). The img element is left unmodified for unsupported browsers.

Download: https://github.com/jackmoore/wheelzoom

Demonstration: https://www.jacklmoore.com/wheelzoom/

Plugin homepage: https://www.jacklmoore.com/wheelzoom/

Implementation:

1. FIRST, INCLUDE JQUERY FILES

<!-- include JS files -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="wheelzoom.jquery.js"></script>

2. ADD YOUR HTML

<p><img src="path_to_image" alt="Alternative Text" /></p>

3. NOW, CALL THE JRATING PLUGIN

<script type="text/javascript">
$(document).ready(function(){
  // Simple call
  $('img').wheelzoom();
 
  // or zoom sets the zoom percent.
  $('img').wheelzoom({zoom:0.05});
 
  // zooming out can be triggered by calling 'wheelzoom.reset'
  $('img').trigger('wheelzoom.reset');
});
</script>

Options:

Screenshots:

How a Loop Through a JavaScript Object?

How a Loop through a JavaScript object?Javascript Objects are Variables Containing Variables.In Java…

How to Search Item in List in JavaScript

Multi Step Form Using HTML and JavaScript

Form is the important part in web design. Form is the primary interface to the user by which user is…

How to Create Custom CSS, jQuery Autocomplete Plugin

Web developers often use autocomplete features in websites as a part of their work. Yet lot of good …

How to Make Sticky Sidebar Using jQuery and CSS

Sticky sidebar is an essential part of web development. Not in all cases but for some cases where ou…

Selectors, Animation, and AJAX – jQuery Tutorial And Examples

By now I’m sure you have grasped at least the basics and simplicity of the jQuery library. Now it’s …