css - 将 Raphael SVG 纸绝对定位到容器 div

标签 css svg raphael

有没有办法让 Raphael paper 对象相对于它所在的 div 是绝对的?从而完全填满 div?由于我正在使用的论文是相对于它的 div 我在调整窗口大小时遇到​​鼠标位置问题以及其他问题。

最佳答案

如果您也在使用 jquery,也许您可​​以在每次调整窗口大小时调整 raphael 纸的大小。您可以使用 jquery resize() 然后使用 raphael 的 setSize() 来执行此操作。

$( window ).resize(function() {   

        //get the size of your container div
        var div_width = $("#containerDiv").width();
        var div_height = $("#containerDiv").height();

        paper.setSize(div_width, div_height);
});

关于css - 将 Raphael SVG 纸绝对定位到容器 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20321903/

相关文章:

css - 使用 xslt 文件将 xml 文件转换为 svg?

javascript - 数组中的补丁组动画出错

c# - 如何在服务器上转换内联 SVG?

javascript - Raphael 动画上的工具提示 - 为什么它不起作用?

javascript - 拆分列(每个 50%)以相反方向滚动 - 连续/循环

css - 如何使渐变线段沿 SVG 路径移动

javascript - Bootstrap : rearrange order of different sized panels on mobile

javascript - D3JS - 以恒定速度沿 svg 路径制作圆圈

html - 删除页脚中多余的黑色背景

html - Bootstrap 3 : what is standard Structure and Layout?