简体   繁体   中英

Javascript scroll on an element

I am trying to emulate scrolling on an element with a zoom in button.

I've gotten this to fire, but the zoom is not what I am looking for. It distorts my canvas element.

    var currentZoom = 1.0;

    $('#zoom-in-button').click(function() {
        $('.vis-network canvas').animate({ 'zoom': currentZoom += 200 });
    });

Using jquery and jquery-ui latest.


UPDATE: When I say animate distorts it... I mean it totally ruins it. 在此处输入图片说明

I think you should use:

currentZoom += 2.0

Zoom values have the value 1 as 'normal'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM