Contacts on map
Рарзметка HTML:
Стили CSS:
a[href^='tel']{
text-decoration: none;
cursor: default;
color:inherit;
}
#ymapc {
position: absolute;
}
.map_block_wr {
height: 333px;
}
.map_block_container {
position: relative;
z-index: 10;
}
.map_block_info {
float: right;
background: rgba(255, 252, 245, 0.90);
padding: 15px 35px 25px;
margin-top: 11px;
width: 380px;
border: 2px solid #fecd8c;
}
.map_block_info_title {
font-size: 22px;
font-family: "roboto slab";
border-bottom: 1px solid #f3ecdc;
margin-bottom: 10px;
}
.map_block_info_list {
font-size: 18px;
margin-bottom: 15px;
list-style-type:none;
}
.map_block_info_fb_title {
font-size: 16px;
font-family: "roboto slab";
border-bottom: 1px solid #f3ecdc;
margin-bottom: 10px;
}
.map_block_info .feedBackWrapper{
padding: 0;
}
.map_block_info .feedBackWrapper .ajaxgo {
padding: 2px 10px;
background: #f6a31c;
font-size: 16px;
border-color: #e89918;
color: #fff;
font-family: "open sans";
}Скрипты JS:
// Карта Яндекс
ymaps.ready(init);
var myMap1;
function init () {
myMap1 = new ymaps.Map(
'ymapc',
{
center: [ 59.884541, 30.32672 ],
zoom: 15,
type: 'yandex#map'
}
);
myPlacemark = new ymaps.Placemark([ 59.884541, 30.32672 ], {
balloonContentHeader: 'CompanyName',
balloonContentBody: 'г .Санкт-Петербург, БЦ «Собрание»
Телефоны:
+7(812)999-99-99
+7(812)999-99-99',
balloonContentFooter:'info@mail.ru',
hintContent: 'Новорощинская д.4'
},{
preset: 'islands#dotIcon'
});
myMap1.geoObjects.add(myPlacemark);
myMap1.behaviors.disable('scrollZoom');
}
// Форма обратной связи (без бэкэнда)
$(document).ready(function(){
$(document.body).on("click", ".ajaxgo", send);
$(document.body).on("focus", "input", function(){$(this).css("border","");});
function send(){
var wr = $(this).parents(".feedBackWrapper");
var validate = true;
wr.find(".isrequired").each(function(){
if(!$(this).val().length){validate = false; $(this).css("border","1px solid #D22")}
});
if (validate){
var need = {};
need['header'] = "Контактная информация";
need['fields'] = [];
wr.find("input, select, textarea").each(function(){
var fieldElement = {};
//Checkbox, Radio
//Ожидаемая семантика: /
if($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio'){
if($(this).prop('checked') == true){
fieldElement['type'] = $(this).attr("type");
fieldElement['title'] = $(this).attr("placeholder");
fieldElement['value'] = $(this).attr("title");
need['fields'][need['fields'].length] = fieldElement;
}
return true;
}
fieldElement['type'] = $(this).attr("type") || 'text';
fieldElement['title'] = $(this).attr("placeholder");
fieldElement['value'] = $(this).val();
need['fields'][need['fields'].length] = fieldElement;
});
output = JSON.stringify(need);
$.ajax({
type: "POST",
data: {data1: output},
url:'js/mail.php',
dataType:'json',
success: function(data){
wr.find(".ajaxgo").hide();
wr.find(".successmsg").html(data.result);
wr.find(".successmsg").fadeIn(300).css("display","inline-block");
},
error: function (xhr, ajaxOptions, thrownError){
console.log(xhr.responseText);
}
});
}
}
});Способ поблагодарить автора сайта:
Комментарии (0)
Не писать ответ