Skip to content

Instantly share code, notes, and snippets.

@orviwan
Created October 6, 2017 12:25
Show Gist options
  • Save orviwan/39a43be3e19a19baf12b577c5e45a074 to your computer and use it in GitHub Desktop.
Save orviwan/39a43be3e19a19baf12b577c5e45a074 to your computer and use it in GitHub Desktop.
Toggle View
<svg>
<svg id="main" display="inline"><text>MAIN</text></svg>
<svg id="info" display="none"><text>INFO</text></svg>
</svg>
import document from "document";
let view1 = document.getElementById("main");
let view2 = document.getElementById("info");
setInterval(function() {
//Every second, toggle views
if (view1.style.display === "inline") {
console.log("Show Main");
view1.style.display = "none";
view2.style.display = "inline";
} else {
console.log("Show Info");
view1.style.display = "inline";
view2.style.display = "none";
}
}, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment