Skip to content

[WIP] - EN/00-01.html Dropdown Menu Select Option to Change Languages #108

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

Merged
merged 7 commits into from
Oct 26, 2017
26 changes: 26 additions & 0 deletions en/00-01.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,29 @@
You can always go back and forth between the steps of the tutorial using the
circles on the top of the page.
</p>


<select id="languageMenu" onchange="changeLanguage()">

<option id = "English" selected href="../en/00-01.html" value="EN_00_01">English</option>
<option id = "Deutsch" href="../de/00-01.html" value="DE_00_01" >Deutsch</option>
<option id = "Svenska" href="../sv/00-01.html" value="SV_00_01">Svenska</option>

</select>

<script>
function changeLanguage() {
var getLanguageMenu = document.getElementById('languageMenu');
var getLanguageHref = getLanguageMenu.options[getLanguageMenu.selectedIndex].getAttribute('href');
window.location.assign(getLanguageHref);

}
</script>
<script src="http://code.jquery.com/jquery-3.2.1.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This site shall also work off-line, without any Internet connection.
This is not important now. Before I merge, I would like to make sure that a downloaded version does not load resources from other locations. This is also a privacy concern as I do not want this page to tell jquery.com that the viewer is interested in this site.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niccokunzmann I can try to figure out a solution to my problem without using JQuery or using the downloaded version of JQuery.

I am still working on this issue and will be continuing the setup of Jekyll locally.

I am one trumpet out of the band here so if there is anything you just do not like, let me know and I can change it.

<script>
$(document).ready(function(){
$("select").each(function(){
$(this).val($(this).find('option[selected]').val());
});
});
</script>