refactor: better variable and ID names
This commit is contained in:
parent
b847b6dce5
commit
328657fedc
1 changed files with 10 additions and 10 deletions
|
@ -16,7 +16,7 @@
|
||||||
work.
|
work.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="hide-message-btn" style="display: none">
|
<div id="hidden-message-wrapper" style="display: none">
|
||||||
<p>
|
<p>
|
||||||
There may be some topics that pop up more than others.
|
There may be some topics that pop up more than others.
|
||||||
<a href="/technology">Technology</a> posts are mostly about web
|
<a href="/technology">Technology</a> posts are mostly about web
|
||||||
|
@ -41,24 +41,24 @@
|
||||||
<p>~ <em>Ayo Ayco</em></p>
|
<p>~ <em>Ayo Ayco</em></p>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
id="read-message-btn"
|
id="show-btn"
|
||||||
style="cursor: pointer; display: none"
|
style="cursor: pointer; display: none"
|
||||||
onclick="toggleMessage()"
|
onclick="toggleMessage()"
|
||||||
>
|
>
|
||||||
Read the full message »
|
Read the full message »
|
||||||
</button>
|
</button>
|
||||||
<script>
|
<script>
|
||||||
var x = document.getElementById("hide-message-btn");
|
var hiddenMessage = document.getElementById("hidden-message-wrapper");
|
||||||
var y = document.getElementById("read-message-btn");
|
var showButton = document.getElementById("show-btn");
|
||||||
y.style.display = "block"; // only show when JS enabled
|
showButton.style.display = "block"; // only show when JS enabled
|
||||||
|
|
||||||
function toggleMessage() {
|
function toggleMessage() {
|
||||||
if (x.style.display === "none") {
|
if (hiddenMessage.style.display === "none") {
|
||||||
x.style.display = "block";
|
hiddenMessage.style.display = "block";
|
||||||
y.innerHTML = "« Read less...";
|
showButton.innerHTML = "« Read less...";
|
||||||
} else {
|
} else {
|
||||||
x.style.display = "none";
|
hiddenMessage.style.display = "none";
|
||||||
y.innerHTML = "Read the full message »";
|
showButton.innerHTML = "Read the full message »";
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue