Added hint system where student can choose difficulty
This commit is contained in:
1 parent
0aad2707b9
commit
8ed17e9987
3 files changed
+35
-4
No files matched your search
+25
-1
@@ -31,6 +31,30 @@ $(function() {
|
||||
|
||||
// Hints
|
||||
$('.hint').replaceWith(function() {
|
||||
return '<div><a href="#" onclick="$(this).next().slideToggle(); return false;">Bekijk hint</a>'+$(this).hide()[0].outerHTML+'</div>';
|
||||
return '<div><a href="#" class="hintlink" onclick="$(this).next().slideToggle(); return false;">Bekijk hint</a>'+$(this).hide()[0].outerHTML+'</div>';
|
||||
});
|
||||
|
||||
$('#difficulty').change(function(e) {
|
||||
var option = $(this).find(':selected').val();
|
||||
|
||||
|
||||
$('.hintlink').toggle(option == 'normal');
|
||||
$('.hint').toggle(option == 'easy');
|
||||
|
||||
|
||||
window.localStorage.setItem('difficulty', option);
|
||||
});
|
||||
|
||||
// Set the selected property
|
||||
if(window.localStorage['difficulty']) {
|
||||
var difficulty = window.localStorage['difficulty'];
|
||||
} else {
|
||||
var difficulty = 'normal';
|
||||
}
|
||||
|
||||
$('#difficulty option').filter(function() {
|
||||
return $(this).val() == difficulty;
|
||||
}).prop('selected', true);
|
||||
$('#difficulty').trigger('change');
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user