54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
$(function()
|
|
{
|
|
/*
|
|
$.get("/api/regions/",
|
|
{
|
|
params: {},
|
|
}, function(response)
|
|
{
|
|
for(let i in response.regions)
|
|
{
|
|
//$("#regions_select").append("<option value='"+response.regions[i]['ID']+"' data-geo-lat='"+response.regions[i]['ID']+"' data-geo-lon='"+response.regions[i]['ID']+"'>"+response.regions[i]['NAME']+"</option>");
|
|
//$("#regions_select_mobile").append("<option value='"+response.regions[i]['ID']+"'>"+response.regions[i]['NAME']+"</option>");
|
|
}
|
|
//$("#regions_select")[0].selectedIndex = 1;
|
|
//$("#regions_select_mobile")[0].selectedIndex = 1;
|
|
}, "json");
|
|
*/
|
|
|
|
$(".regions_select").on("change", function()
|
|
{
|
|
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)
|
|
{
|
|
$(".dropdown_block").removeClass("open");
|
|
$("#region_"+parseInt($(this).val(), 10)).addClass("open");
|
|
$('html, body').animate({
|
|
scrollTop: $("#region_"+parseInt($(this).val(), 10)).offset().top - 100
|
|
}, 200);
|
|
}
|
|
else
|
|
{
|
|
$('html, body').animate({
|
|
scrollTop: $("#contacts_top").offset().top - 100
|
|
}, 200);
|
|
}
|
|
});
|
|
|
|
$(".contacts_show_office_on_map").on("click", 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);
|
|
});
|
|
}); |