Created
October 6, 2017 12:25
-
-
Save orviwan/39a43be3e19a19baf12b577c5e45a074 to your computer and use it in GitHub Desktop.
Toggle View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg> | |
<svg id="main" display="inline"><text>MAIN</text></svg> | |
<svg id="info" display="none"><text>INFO</text></svg> | |
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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