%PDF- %PDF-
| Direktori : /home/bitrix/www/bitrix/templates/Ajax/components/bitrix/catalog.section/section_t/ |
| Current File : //home/bitrix/www/bitrix/templates/Ajax/components/bitrix/catalog.section/section_t/script.js |
BX.ready(function(){
$('#btn-show-online').click(function() {
if ($(this).attr('data-online')=='N') {
$('.post-content div.item[data-online="N"]').hide();
$(this).attr('data-online','Y');
$(this).addClass("selected");
}
else {
$('.post-content div.item[data-online="N"]').show();
$(this).attr('data-online','N');
$(this).removeClass("selected");
}
});
$('.post-content .animate_afc').each(function(){
$(this).attr('data-animate','Y');
});
/* On/Off catalog filter */
$("#close_search").click(function () {
$(this).hide();
$('#but_onoff').show();
$(".filtrs").slideUp(200);
$(".fs_types").hide(100);
$("#del_filter").trigger('click');
});
$("#but_onoff").click(function () {
$(this).hide();
$('#close_search').show();
$('input.min-price').prop('disabled',true);
$('input.max-price').prop('disabled',true);
$(".filtrs").slideDown(200);
$(".fs_types").show(200);
setTimeout(function(){
$(".filtrs").css("overflow", "visible");
}, 200)
});
$("#f_extended").click(function () {
if($("#f_extended").attr('class')!="f_ex_y") {
$('input.min-price').prop('disabled',false);
$('input.max-price').prop('disabled',false);
$(".container2").fadeIn(600);
$(this).attr('class', 'f_ex_y');
} else {
$(".container2").fadeOut(600);
$(this).attr('class', 'f_ex_n');
// Запрещаем все элементы MIN/MAX
$('input.min-price').prop('disabled',true);
$('input.max-price').prop('disabled',true);
}
});
$("#region_sl").change(function () {
var vl = $(this).val();
$("#region_sl option:selected").each(function () {
if ($(this).val()==vl) {
$(".region_fh").attr("name",$(this).attr("name"));
$(".region_fh").attr("value",$(this).attr("value"));
if($("#f_extended").attr("class")!="f_ex_y") $("#set_filter").trigger("click");
}
});
});
$("#city_sl").change(function () {
var vl = $(this).val();
$("#city_sl option:selected").each(function () {
if ($(this).val()==vl) {
$(".city_fh").attr("name",$(this).attr("name"));
$(".city_fh").attr("value",$(this).attr("value"));
if($("#f_extended").attr("class")!="f_ex_y") $("#set_filter").trigger("click");
}
});
});
if ((typeof s_ftr !=="undefined") && s_ftr) $("#but_onoff").trigger('click');
if ((typeof e_ftr !=="undefined") && e_ftr) $("#f_extended").trigger('click');
$(window).scroll(function(){
marginTop = 125;
marginBottom = 50;
// Проверка на подвал
fot_y = $('#footer').offset().top - $('.e-reclama').offset().top - $('.e-reclama').height() - marginBottom;
isFooter = fot_y<0;
if (isFooter) { // Доехали до подвала
if ($('#footer').attr('data-float-banner')=='Y') {
if ($(document).scrollTop()-$('.e-reclama').offset().top < $('#footer').attr('data-float-delta')) { // Проверяем, надо ли летать
$('#footer').attr('data-float-banner','N');
isFooter = false;
}
}
else { // Останавливаем полет баннера
$('#footer').attr('data-float-banner','Y');
$(".e-reclama").css("position", "relative");
$(".e-reclama").css("top", $('#footer').offset().top - $('.e-reclama').height() - marginBottom - marginTop - 60);
$('#footer').attr('data-float-delta',$(document).scrollTop()-$('.e-reclama').offset().top);
}
}
if (!isFooter) { // Не доехали до подвала или ситуация поменялась
top_y = $('.smartBannerIdentifier').offset().top - marginTop;
if ($(window).scrollTop() > top_y){ // Летаем
$(".e-reclama").css("position", "fixed");
$(".e-reclama").css("top", marginTop);
}
else if ($(window).scrollTop() <= top_y) { // Останавливаем
$(".e-reclama").css("position", "relative");
$(".e-reclama").css("top", 0);
}
}
});
});
function after_scroll_animate(XMLHttpRequest, textStatus) {
// Перенос PRO в свой слой
$('div.pro_block[data-pro="Y"]').each(function(){
$(this).attr('data-pro','N');
$(this).removeClass('pro_block');
$('#pro_block div:last').remove();
$('#pro_block').append($(this));
});
// Подключение анимации
$('.post-content .animate_afc[data-animate!="Y"]').waypoint(function () {
if (!$(this).hasClass("animate_start")) {
var e = $(this);
setTimeout(function () {
e.addClass("animate_start")
}, 20)
}
}, {
offset: "85%",
triggerOnce: !0
})
// Пометка, что анимация обработана
$('.post-content .animate_afc[data-animate!="Y"]').each(function(){
$(this).attr('data-animate','Y');
});
}