📜  如何制作响应式 svg - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:05.239000             🧑  作者: Mango

代码示例2
const svg = document.querySelector('svg');

svg.style.height = `${window.innerHeight}px`;
window.addEventListener('resize', () => { // for every screen resize, the svg height remains 100% relative to the window height
  svg.style.height = `${window.innerHeight}px`;
  console.log(window.innerWidth)
});