Private
Public Access
1
0

works better now (menu state)

This commit is contained in:
Sander Roosendaal
2018-10-23 14:51:53 +02:00
parent 296ac8147b
commit d6c8d48d2d
2 changed files with 18 additions and 7 deletions

View File

@@ -1 +0,0 @@
E408191@CZ27LT9RCGN72.14924:1540272798

View File

@@ -4,19 +4,31 @@
</script>
<script>
$(document).ready(function(){
$(".has-children").each(
$(".has-children input").each(
function(i, obj) {
var theid = $(this).attr('id');
var theid = $(this).parent().attr('id');
var state = localStorage.getItem(theid);
if (state !== null) {
$(this).find('input:first').prop("checked",state);
console.log('setting');
console.log(theid);
console.log(state);
if (state == 'true') {
$(this).prop('checked',true);
console.log('setting checked');
} else {
$(this).prop('checked',false);
console.log('removing checked');
};
};
console.log($(this).is(':checked'));
});
});
$(function() {
$(".has-children").click( function() {
var theid = $(this).attr('id');
var state = $(this).find('input:first').is(':checked');
$(".has-children input").change( function() {
var theid = $(this).parent().attr('id');
var state = $(this).is(':checked');
console.log(theid);
console.log(state);
localStorage.setItem(theid,state);
});
});