Для вертикальной прокрутки внутри блоков, созданных с использованием fullPage
, использовать параметр:
Полный пример:
$(document).ready(function(){
$('#fullpage').fullpage({
anchors:['section-0','section-1','section-2'],
menu:'#navigation',
verticalCentered:false,
scrollOverflow:true,
afterLoad:function(anchorLink,index){
if(anchorLink=='section-0'){
$('#navigation').hide();
}
else{
$('#navigation').show();
}
},
});
});
<ul id="navigation">
<li data-menuanchor="section-1"><a href="#section-1">Section 1</a></li>
<li data-menuanchor="section-2"><a href="#section-2">Section 2</a></li>
</ul>
<div id="fullpage">
<div data-anchor="section-0" class="section section-0"></div>
<div data-anchor="section-1" class="section section-1"></div>
<div data-anchor="section-2" class="section section-2"></div>
</div>
.section-0{
background:red;
}
.section-1{
background:green;
}
.section-2{
background:blue;
}
#navigation{
position:fixed;
top:100px;
left:20px;
z-index:100;
}
#navigation li.active a{
color:red;
}
http://alvarotrigo.com/fullPage/
https://github.com/alvarotrigo/fullPage.js
Чтобы удалить из строки, содержащей html, элемент с его содержимым, в примере div
var str_html=$('.container').html();
str_html=str_html.replace(/<div[^>]*?>[\s\S]*?<\/div>/i,'');
Чтобы удалить элемент с определенным class, в примере class="classname"
str_html=str_html.replace(/<div.*(class="classname")[^>]*?>[\s\S]*?<\/div>/i,'');
В примере по адресу определяем район СПБ: Выборгский, Приморский и т.д.
Логика:
- Прямым геокодированием определяем координаты объекта.
- Обратным геокодированием с kind=district получаем район.
Подключаем api Яндекс:
<script src="//api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
Input:
<input type="text" name="address" id="address"/>
JS:
ymaps.ready(init);
function init(){
var suggestView=new ymaps.SuggestView('address');
suggestView.events.add('select',function(event){
var selected=event.get('item').value;
ymaps.geocode(selected,{
results:1
}).then(function(res){
return ymaps.geocode(res.geoObjects.get(0).geometry.getCoordinates(),{
kind:'district',
results:10
}).then(function(res){
var founded=res['metaData']['geocoder']['found'];
$('label.suggest .description').html("");
for(i=0;i<=founded-1;i++){
var info=res.geoObjects.get(i).properties.getAll();
console.log(info);
var name=info['name'];
if(name.search('район')!=-1){
name=name.replace(' район','');
console.log(name);
}
}
});
});
});
}
Например, когда нужны маркеры разных цветов.
Параметр icon
:
var marker=new google.maps.Marker({
position:iLatlng,
map:map,
icon:'http://maps.google.com/mapfiles/ms/icons/green-dot.png',
//icon:'http://maps.google.com/mapfiles/ms/icons/blue-dot.png',
//icon:'http://maps.google.com/mapfiles/ms/icons/red-dot.png',
title:'FullAddress'
});
Если нужно самому динамически указывать цвет:
http://www.googlemapsmarkers.com/v1/COLOR/
или
http://www.googlemapsmarkers.com/v1/LABEL/COLOR/
или
http://www.googlemapsmarkers.com/v1/LABEL/FILL COLOR/LABEL COLOR/STROKE COLOR/
подробнее: http://www.googlemapsmarkers.com/
var icon_green=new google.maps.MarkerImage("http://www.googlemapsmarkers.com/v1/C/008136/ffffff/008136/");
var marker=new google.maps.Marker({
position:iLatlng,
map:map,
icon:icon_green,
title:'FullAddress'
});