76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
$(function()
|
|
{
|
|
$(".regions_select").on("change", function()
|
|
{
|
|
if($(this).val() === "")
|
|
{
|
|
$(".region_selected").remove();
|
|
$(".region_block").css("display", "block");
|
|
|
|
window.map.setCenter([ 55.178521758435, 61.416163746216 ], 3.8);
|
|
}
|
|
else
|
|
{
|
|
var geo = $(this).find(':selected').data("geo");
|
|
var zoom = $(this).find(':selected').data("zoom");
|
|
var coords = geo.split(",");
|
|
|
|
window.map.setCenter([ coords[0], coords[1] ], zoom);
|
|
|
|
if($('.tab.active').index() === 1)
|
|
{
|
|
$('html, body').animate({
|
|
scrollTop: $("#contacts_top").offset().top - 100
|
|
}, 200);
|
|
}
|
|
else
|
|
{
|
|
$('html, body').animate({
|
|
scrollTop: $("#contacts_top").offset().top - 100
|
|
}, 200);
|
|
}
|
|
|
|
$(".region_selected").remove();
|
|
$(".region_block").css("display", "none");
|
|
|
|
var text_blocks = $(".column_desktop").find(".region_"+parseInt($(this).val(), 10));
|
|
|
|
text_blocks.map(function(index, item)
|
|
{
|
|
var n = $(item).clone();
|
|
$(n).addClass("open").addClass("region_selected").css("display", "block");
|
|
|
|
if(index % 2 == 0)
|
|
{
|
|
$(".column_left").append(n);
|
|
}
|
|
else
|
|
{
|
|
$(".column_right").append(n);
|
|
}
|
|
});
|
|
|
|
var text_blocks = $(".column_mobile").find(".region_"+parseInt($(this).val(), 10));
|
|
|
|
text_blocks.map(function(index, item)
|
|
{
|
|
var n = $(item).clone();
|
|
$(n).addClass("open").addClass("region_selected").css("display", "block");
|
|
|
|
$(".column_all").append(n);
|
|
});
|
|
}
|
|
});
|
|
|
|
$("body").on("click", ".contacts_show_office_on_map", function()
|
|
{
|
|
const geo = $(this).data("geo");
|
|
var coords = geo.split(",");
|
|
window.map.setCenter([ coords[0], coords[1] ], 9);
|
|
|
|
$(".tab").first().click();
|
|
$('html, body').animate({
|
|
scrollTop: $("#contacts_top").offset().top - 100
|
|
}, 100);
|
|
});
|
|
}); |