Created
October 4, 2017 13:50
-
-
Save BlaM/4b2b584c1de51699896f2d098bab8f62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var autoset = null; | |
var isMoved = false; | |
$(document).on('mouseup', function() { | |
autoset = null; | |
isMoved = false; | |
}); | |
$('#campaign-list').on('mousedown', 'input[type=checkbox]', function(e) { | |
autoset = !$(this).prop('checked'); | |
$(this).prop('checked', autoset); | |
}); | |
$('#campaign-list').on('mouseup', 'input[type=checkbox]', function(e) { | |
if (!isMoved) { | |
$(this).prop('checked', !autoset); | |
} | |
}); | |
$('#campaign-list').on('mouseover', 'div.checkbox', function() { | |
if (autoset === null) { | |
return; | |
} | |
isMoved = true; | |
$(this).find('input[type=checkbox]').prop('checked', autoset); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment