Is there a way to make a section of my website where, upon pressing a button, the button moves to the left and reveals collapsed text that appears below it with some padding on top? I've been trying to achieve this as a beginner by looking through documentation and conducting Google searches, but haven't had any success yet. Any help is greatly appreciated!
Code:
const sourcesButton = document.querySelector('#bibliographySources');
let bibliographySources = document.getElementById("bibliographySources");
bibliographySources.style.display = "none";
function showSources() {
let sourceStyling = document.getElementById("bibliographySources");
if (sourceStyling.style.display === "none") {
sourceStyling.style.display = "block";
} else {
sourceStyling.style.display = "none";
}
}
.sourcesButton {
position: relative;
}
.footerStyling {
color: white;
padding: 1rem;
}
.sourceStyling {
color: white;
padding: 2rem;
}
.bibliographySources {
padding: 1 0 0 0rem;
clear: both;
}
footer {
display: flex;
background-color: #655A06;
justify-content: center;
}
<!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b6964647f787f796a7b4b3e253b253a">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<!-- Footer -->
<footer>
<div class="footerStyling" id="footer">
<a onclick="showSources()" id="#bibliography" class="btn rounded btn-outline-light sourcesButton">Sources</a>
</div>
<section>
<div class="row sourceStyling bibliographySources" id="bibliographySources">
<p>
Carbon Neutral by 2040 (Oleksyn, 2021)<br>
<br>World goal of Carbon Neutrality by 2050 (Oleksyn, 2021)<br>
<br>Donut Chart showing the sources of emissions amongst industries (Saskatchewan, 2020)<br>
<br>Saskpower looking to supply power through solar energy & more by 2030 (Praill, 2018)<br>
<br>Canada GHG Emission Heatmap - (Saskatchewan, 2020)<br>
<br>Saskatchewan’s CO2 Emissions 76.4Mt in 2018 - (Saskatchewan, 2020)<br>
<br>Canada’s CO2 Emissions 728Mt in 2018 - (Government of Canada, 2019)<br>
<br>Sources of GHG Emissions from Federal Fleets in Canada - (Saskatchewan, 2020)<br>
<br>221 MW of operating wind capacity spread across 143 turbines, generating 3.1% of Saskatchewan's electricity - (SaskWind, 2020)<br>
<br>
</p>
<h3>
References
</h3>
<p>
<br>Government of Canada. (2019). Government of Canada. Retrieved from Greenhouse gas emissions:<br> https://www.canada.ca/en/environment-climate-change/services/environmental-indicators/greenhouse-gas-emissions.html<br>
<br>Oleksyn, M. (2021, April 27). SES report sees carbon neutral grid by 2040 possible for SaskPower. Retrieved from Prince Albert Daily Herald:<br> https://paherald.sk.ca/2021/04/27/ses-report-sees-carbon-neutral-grid-by-2040-possible-for-saskpower/<br>
<br>Praill, C. (2018, June 19). SaskPower announces 10 megawatt solar project, first in Sask. Retrieved from Global News:<br> https://globalnews.ca/news/4284462/saskpower-announces-10-megawatt-solar-project-first-in-sask/<br>
<br>Saskatchewan. (2020). Retrieved from Greenhouse Gas Emissions:<br> https://www.saskatchewan.ca/residents/environment-public-health-and-safety/state-of-the-environment/saskatchewans-state-of-the-environment/greenhouse-gas-emissions<br>
<br>SaskWind. (2020). SaskWind. Retrieved from Location of Saskatchewan Wind Farms:<br> https://www.saskwind.ca/location-of-sk-wind-farms<br>
</p>
</div>
</section>
</footer>