Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added toggable button for explanation #35

Merged
merged 3 commits into from Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions assets/css/main.scss
Expand Up @@ -170,6 +170,28 @@ body {
text-decoration: none;
}

.Explanation{
font-size: 1rem;
}

.Toggle-Explanation{
display: none;
background-color: $theme-primary;
background-color: var(--theme-primary);
font-size: 1rem;
border: none;
color: #fff;
color: var(--theme-color);
padding: .75em 1.5em;
text-align: center;
transition: 0.3s;
display: inline-block;
text-decoration: none;
border-radius: 15px;
cursor: pointer;
}



@media only screen and (max-width: 35rem) and (orientation: landscape) {
.App__title { display: none; }
Expand Down
11 changes: 10 additions & 1 deletion assets/js/main.js
Expand Up @@ -5,10 +5,19 @@ function displayViewport(event) {
document.getElementById('h').innerHTML = verge.viewportH();
}

function explanation() {
var x = document.getElementsByClassName('Explanation');
if (x[0].style.display === "none") {
x[0].style.display = "block";
} else {
x[0].style.display = "none";
}
}

window.addEventListener('load', displayViewport, false);
window.addEventListener('resize', displayViewport, false);
window.addEventListener('orientationchange', displayViewport, false);

document.querySelectorAll('.Footer-toggle')[0].addEventListener('click', function(event) {
document.querySelectorAll('.Footer')[0].classList.toggle('Expanded');
}, false);
}, false);
4 changes: 4 additions & 0 deletions index.html
Expand Up @@ -38,6 +38,9 @@ <h1 class="App__title">Your viewport size is:</h1>
&times;
<span id="h"></span>
</p>

<button onclick="explanation()" class="Toggle-Explanation">Is this my screen resolution?</button>
<p class="Explanation">Screen resolution is not the same as viewport size. Viewport refers to the visible area of a webpage on a device, while Screen resolution is the amount of pixels a device has</p>
</article>
</main>

Expand Down Expand Up @@ -73,6 +76,7 @@ <h2 class="Footer__title">Made with all the love we could be bothered to muster<
if (isIEOld || isIERecent) {
body.className += ' ie-legacy';
}

</script>

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-39417124-2"></script>
Expand Down