Skip to content

Commit

Permalink
Merge pull request #99 from Seshat-Global-History-Databank/mobile-fri…
Browse files Browse the repository at this point in the history
…endly

Mobile friendly version of world map
  • Loading branch information
edwardchalstrey1 authored Sep 26, 2024
2 parents 6a99206 + 5464b78 commit 69fce65
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 126 deletions.
16 changes: 16 additions & 0 deletions seshat/apps/core/static/core/js/map_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ function storeYear() {
}
}

function storeYearMobile() {
document.getElementById('enterYear').value = document.getElementById('enterYearMobile').value;
if(document.getElementById('enterYearMobile').value >= 0) {
document.getElementById('switchToBCE').innerHTML = 'To BCE';
};
}

function switchToBCE() {
if (document.getElementById('enterYearMobile').value < 0) {
document.getElementById('switchToBCE').innerHTML = 'To BCE';
} else {
document.getElementById('switchToBCE').innerHTML = 'To CE';
}
document.getElementById('enterYearMobile').value = 0 - document.getElementById('enterYearMobile').value;
}

function switchBaseMap() {
var selectedMap = document.querySelector('input[name="baseMap"]:checked').value;
var base = document.getElementById("baseMapGADM").value
Expand Down
8 changes: 7 additions & 1 deletion seshat/apps/core/templates/core/polity/polity_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h1 class="h1 text-teal federicka-bigger"> {{ object.long_name }}</h1>

</div>

<div>
<div id="polityMap">
{% polity_map pk %}
<br><p></p><br>
</div>
Expand Down Expand Up @@ -1940,6 +1940,12 @@ <h6>
</div>

<script>

// Don't show map template if on mobile
if (window.innerWidth < 768) {
document.getElementById('polityMap').style.display = 'none';
}

// Function to handle smooth scrolling to an element with offset
function scrollToElementWithOffset(elementId, offset) {
var targetElement = $(elementId);
Expand Down
Loading

0 comments on commit 69fce65

Please sign in to comment.