javascript - Jquery panzoom on click -
looking implement jquery plugin allows zoom svg elements. https://github.com/timmywil/jquery.panzoom
what having issues implementing zoom functionality when user clicks on element, while using 'duration' parameter available in framework.
an example
var $section = $('section').first(); $panzoom = $section.find('.panzoom').panzoom({ contain: false, minscale: 1, maxscale: 3, contain: true, duration: 1200 }).panzoom('zoom', true);
some html
<element class='test'/>
some click handler
$('.test').on('click' function(){ $panzoom.panzoom("zoom", 2.5); });
this zoom in, not use 'duration' provided.
it looks calling zoom zoom in, , calling zoom true parameter zoom out. doesnt seem zooming maxscale.
//in $panzoom.panzoom("zoom"); //out $panzoom.panzoom("zoom", true);
just guess, api, expect call more this...
... first setup selectors...
var $section = $('section').first(), $panzoom = $section.find('.panzoom');
... later on ...
$('.test').on('click' function(){ $panzoom.panzoom("zoom", 2.5, { contain: false, minscale: 1, maxscale: 3, contain: true, duration: 1200 }); });
Comments
Post a Comment