.default-bg{}
.active-bg{}
$('li').on('click', function() {
$(this).addClass('active-bg').siblings().removeClass('active-bg');
});
function debounce(method, timeout) {
clearTimeout(method._tId);
method._tId = setTimeout(function(){
method();
}, timeout);
} }, timeout);
}
function checkTitle() {
//Код проверки
}
$('input').on('keyup', function() {
debounce(checkTitle, 1000);
});
function exists() {
return $('.nav-link button').hasClass('close');
}
function formatState (state) {
if (!state.id) {
return state.text;
}
var $state = $(
'<span>' + state.text + '</span>'
);
return $state;
};
$('select[name="projects[]"]').select2({
ajax: {
url: "/manager/project/find-projects",
dataType: 'json',
type : 'POST',
delay: 250,
data: function (params) {
return {
q: params.term,
};
},
processResults: function (data, page) {
return {
results: data
};
},
cache: true
},
initSelection: function(element, callback) {
var array = [];
$(element).find('option:selected').each(function() {
var obj = {id : $(this).val(), name : $(this).text()};
array.push(obj);
});
callback(array);
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateResult: formatState,
templateSelection: formatState
});
$('a').on('click', function(){
if ($(this).attr('data-toggle')) {
console.log('Второй клик');
$(this).removeAttr('data-toggle');
} else {
console.log('Первый клик');
$(this).attr('data-toggle', 1);
}
});
$('section').each(function() {
var count = $(this).find('li').length;
if (count > 4) {
var filter_trigger = $(this).find('.filter-height-trigger');
filter_trigger.show();
//дальнейшие операции над filter_trigger
}
});