PDA

View Full Version : Trigger Featured Zoom with buttons instead of scroll wheel



tbarmann
06-20-2013, 03:34 PM
1) Script Title: Featured Image Zoomer v2.2

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...uredzoomer.htm

3) Describe problem: Can anyone offer help as to how can I add zoom-in and zoom-out buttons to this script? For users who
don't have a mouse wheel, I need to provide a way for them to zoom.

Thanks for any help!
Tim

jscheuer1
06-23-2013, 03:51 AM
Well this script is useless on most mobile/touch devices as well because it requires actions they're incapable of. So I would provide alternate content via a link for users that cannot use it. That said, here's an update of the script that allows for button control of the zoom level (right click and 'Save As'):

5106

To use it, say you have a zoom setup on the page (it must have a zoomrange for this to work):


<script type="text/javascript">

jQuery(document).ready(function($){

$('#image1').addimagezoom({
zoomrange: [3, 10],
magnifiersize: [300,300],
magnifierpos: 'right',
cursorshade: true,
largeimage: 'hayden.jpg' //<-- No comma after last option!
})

});

</script>

Now you can have buttons, images or links like:


<input class="image1 zoom in" type="button" value="Zoom In"> <input class="image1 zoom out" type="button" value="Zoom Out">

The important thing is the class. It must have the id of the image (image1 in this case), the word zoom, and then either in or out (for which way you want clicking on it to zoom the image. It cannot have any other names in its class and it must have the image id, zoom and one of either in or out.

You can also have a span with a class of 'id_of_the_image zoomlevel':


Curent Zoom: <span class="image1 zoomlevel"></span>

It will show the current zoom level.

Also works with multi-zooms.

Any questions, just let me know.