I did some research on the matter, but it doesn't seem to be working.
I want to be able to make a <svg>
container that encompasses the entire screen of the browser (aka everything that isn't a tab, toolbar, etc. etc.).
So if you look at the picture, I want the <svg>
to occupy everything below the tab toolbar to the bottom of the page (is it the viewport or window?)—aka everything in the red box.
Here's the code I have so far (just the <script />
):
<script>
function startThePage(){
var height = $(document).height();
var width = $(document).width();
var svgSelection =
d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var myCircle = svgSelection
.append("circle")
.attr("cx", (width/2))
.attr("cy", (height/2))
.attr("r", 22)
.style("fill", "lightgray")
.style("stroke", "gray");
};
//alert(window.screen.availWidth);
//alert(window.screen.availHeight);
</script>
For some reason this seems to make the document slightly bigger, meaning the user can scroll back and forth (for now there's just a filler circle in it, which I want to center). This puts the circle out of center. How do I fix that?