Clicking grant labels now correctly toggles the check mark.
This commit is contained in:
parent
d28ab68abc
commit
40bfe2e534
25
js/script.js
25
js/script.js
|
@ -47,25 +47,28 @@ $('body').on('click', '.js-remember-label', function (ev) {
|
|||
|
||||
$('body').on('click', '.check', function () {
|
||||
'use strict';
|
||||
var $img = $(this);
|
||||
if($img.attr("src") === "./img/pressed-check.png") {
|
||||
$img.attr("src", "./img/unpressed-check.png");
|
||||
$img.removeClass("is-checked");
|
||||
} else if($img.attr("src") === "./img/unpressed-check.png") {
|
||||
$img.attr("src", "./img/pressed-check.png");
|
||||
$img.addClass("is-checked");
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.js-auth-li-enabled', function (ev) {
|
||||
'use strict';
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
|
||||
var $this = $(this);
|
||||
if ($this.find('.js-auth-checkbox').is(':checked') === true) {
|
||||
$this.find('.js-auth-checkbox').prop( "checked", false );
|
||||
var $hiddenCheckbox = $this.find('.js-auth-checkbox');
|
||||
var $img = $this.find('.check');
|
||||
var newStatus = $hiddenCheckbox.prop('checked') ? "unchecked" : "checked";
|
||||
|
||||
if(newStatus === 'checked') {
|
||||
|
||||
$img.attr('src', './img/pressed-check.png');
|
||||
$img.addClass("is-checked");
|
||||
$hiddenCheckbox.prop( "checked", true );
|
||||
} else {
|
||||
$this.find('.js-auth-checkbox').prop( "checked", true );
|
||||
$img.attr("src", "./img/unpressed-check.png");
|
||||
$img.removeClass("is-checked");
|
||||
$hiddenCheckbox.prop( "checked", false );
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue