Ama*_*pta 2 canvas twitter-bootstrap paperjs
我试图在paper.js中创建一个带有导航栏的网站,其中包含4个圆圈。但是,使用resize选项,canvas元素将占据整个页面。我已经使用了http://paperjs.org/tutorials/getting-started/working-with-paper-js/上给出的示例,而我正在使用twitter bootstrap进行其他操作。我正在使用col-md-12包含画布的div。我尝试了在make canvas上给出与父级一样宽和一样高的解决方案,但是它不起作用。
有什么帮助吗?
您可以使用Javacript实现它:
$(window).resize(resizeAndRedrawCanvas);
function resizeAndRedrawCanvas()
{
var desiredWidth = w; // For instance: $(window).width();
var desiredHeight = h; // For instance $('#canvasContainer').height();
canvas.width = desiredWidth;
canvas.height = desiredHeight
view.viewSize = new Size(desiredWidth, desiredHeight);
view.draw();
}
Run Code Online (Sandbox Code Playgroud)