Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Javascript设置窗口缩放?_Javascript_Jquery_Html_Css_Svg - Fatal编程技术网

如何使用Javascript设置窗口缩放?

如何使用Javascript设置窗口缩放?,javascript,jquery,html,css,svg,Javascript,Jquery,Html,Css,Svg,在html+SVG中 html, body { width: 100%; height: 100%; margin: 0; padding: 0; } #svgWrapper { position: relative; overflow: hidden; width: 2614px; height: 1991px; } #svg { position: absolute; margin: 0 aut

在html+SVG中

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }
  #svgWrapper {
    position: relative;
    overflow: hidden;
    width: 2614px;
    height: 1991px;
  }

  #svg {
    position: absolute;
    margin: 0 auto;
    width: 2614px;
    height: 1991px;
  }
SVG图像非常大(地铁地图) 正文有一个SVG,这个操作应该在手机上进行

当您单击SVG的一个元素时,我想创建并放大中心的元素

下面的代码将元素放置在中心

windo.innerWidth()显示不正确,是否使用SVG中的缩放

如何更改窗口本身的缩放级别

setCenterWithStationId: function (station_id){
  station = Snap.select(".station#"+station_id);
  bound = station.getBBox()                          
  var half_width = window.innerWidth/2
  var half_height = window.innerHeight/2
  window.scrollTo(bound.x - half_width, bound.y - half_height);
  }

你用谷歌翻译吗?对不起。已翻译。您可以使用库进行缩放--