Answer the question
In order to leave comments, you need to log in
How to fix problem in Safari (IOS 9.3.5 - ipad 2, iphone 4)?
When you click on the sub_wrapper block, the list block opens.
$('.list').hide();
function char_db(sub, char){ //выдаем разделы
if( (sub == 1) || (sub == 2) || (sub == 3) ) {
sub = Number.parseInt(sub);
$.ajax({
type: "POST",
url: "/char",
data: {asub : sub},
success:function (resp) {
let text = JSON.parse(resp);
for(i = 0; i < text.length; i++){
$('.charter_i').find('ul').append('<li data="'+ text[i]['id'] + '">' + (i+1) + '. ' + text[i]['names'] +'</li>');
}
show_charter(char);
}
}).fail(function () {
return;
});
} else {
return;
}
}
$('.sub_wrapper').on("click", function(){ //обрабатываем клик
if (!($('.list.charter_i').hasClass('visi'))) { //если не показаны разделы
let char = $(this);
let sub = $(this).attr('data');
char_db(sub, char);
} else {
if ($(this).find('span').hasClass('detected')) {return}
hide_charter();
};
});
Answer the question
In order to leave comments, you need to log in
Try like this:
$('.list').hide();
function char_db(sub, char) {
//выдаем разделы
if (sub == 1 || sub == 2 || sub == 3) {
sub = Number.parseInt(sub);
$.ajax({
type: "POST",
url: "/char",
data: { asub: sub },
success: function success(resp) {
var text = JSON.parse(resp);
for (i = 0; i < text.length; i++) {
$('.charter_i').find('ul').append('<li data="' + text[i]['id'] + '">' + (i + 1) + '. ' + text[i]['names'] + '</li>');
}
show_charter(char);
}
}).fail(function () {
return;
});
} else {
return;
}
}
$('.sub_wrapper').on("click", function () {
//обрабатываем клик
if (!$('.list.charter_i').hasClass('visi')) {
//если не показаны разделы
var char = $(this);
var sub = $(this).attr('data');
char_db(sub, char);
} else {
if ($(this).find('span').hasClass('detected')) {
return;
}
hide_charter();
};
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question