works better now (menu state)
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
E408191@CZ27LT9RCGN72.14924:1540272798
|
|
||||||
@@ -4,19 +4,31 @@
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(".has-children").each(
|
$(".has-children input").each(
|
||||||
function(i, obj) {
|
function(i, obj) {
|
||||||
var theid = $(this).attr('id');
|
var theid = $(this).parent().attr('id');
|
||||||
var state = localStorage.getItem(theid);
|
var state = localStorage.getItem(theid);
|
||||||
if (state !== null) {
|
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() {
|
$(function() {
|
||||||
$(".has-children").click( function() {
|
$(".has-children input").change( function() {
|
||||||
var theid = $(this).attr('id');
|
var theid = $(this).parent().attr('id');
|
||||||
var state = $(this).find('input:first').is(':checked');
|
var state = $(this).is(':checked');
|
||||||
|
console.log(theid);
|
||||||
|
console.log(state);
|
||||||
localStorage.setItem(theid,state);
|
localStorage.setItem(theid,state);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user