Skip to content

Instantly share code, notes, and snippets.

@MichaelGitArt
Last active April 25, 2021 13:59
Show Gist options
  • Save MichaelGitArt/b64680e07decf22b4eef090f87bc76dc to your computer and use it in GitHub Desktop.
Save MichaelGitArt/b64680e07decf22b4eef090f87bc76dc to your computer and use it in GitHub Desktop.
old
// Включить автопроигрывание хедера
// ЧПУ нормальное
// Тест на телефоне
// Google Map
var map;
var markers = [];
var iconBasis = '/wp-content/themes/m1_template/img/icons/marker.png';
// var uluru = { lat: -25.344, lng: 131.036 };
var geocoder;
function initMap() {
geocoder = new google.maps.Geocoder();
map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
// center: uluru,
mapTypeControl: false,
fullscreenControl: true
});
// addMarker(uluru);
if ($('.single-address').text()) {
codeAddress($('.single-address').text());
}
}
function codeAddress(textLocation) {
var address = textLocation;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == 'OK') {
clearMarkers();
markers = [];
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: iconBasis
});
} else {
alert('Не правильно введен адресс: ' + status);
}
});
}
function addMarker(location) {
var marker = new google.maps.Marker({
position: location,
map: map,
icons: iconBasis
});
markers.push(marker);
}
function setMapOnAll(map) {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(map);
}
}
function clearMarkers() {
setMapOnAll(null);
}
function showMarkers() {
setMapOnAll(map);
}
function deleteMarkers() {
clearMarkers();
markers = [];
}
$(function () {
let nav = $('.nav');
let mobileNav = $('.mobile-nav');
let switchNav = $('.toggle-menu');
nav.find('a').each(function () {
var link = $(this);
if (link.parent().hasClass('menu-item-has-children')) {
link.append($('<div class="nav-open"><div class="form"></div></div>'));
}
});
switchNav.click(function () {
if (switchNav.hasClass('on')) {
toggleMenu(false);
} else {
toggleMenu(true);
}
return false;
})
function toggleMenu(show) {
if (show) {
switchNav.addClass('on');
mobileNav.fadeIn();
return;
}
switchNav.removeClass('on');
mobileNav.fadeOut();
}
$(document).mouseup(function (e) {
var div = $(".mobile-nav");
if (
!div.is(e.target)
&& !switchNav.is(e.target)
&& div.has(e.target).length === 0
&& switchNav.has(e.target).length === 0
&& switchNav.hasClass('on')) {
toggleMenu(false);
}
});
$('.show-reviews').click(function () {
$('.hidden-reviews').slideToggle();
$(this).children('span').toggle();
return false;
});
let lang = $('.form-lang').text();
if (typeof $().dateRangePicker !== "undefined") {
$('.form-textfield--date-in').dateRangePicker({
autoClose: true,
singleDate: true,
singleMonth: true,
language: lang,
format: 'DD.MM.YYYY',
startOfWeek: lang === 'en' ? 'sunday' : "monday",
showShortcuts: false,
batchMode: true
});
$('.form-textfield--date-out').dateRangePicker({
autoClose: true,
singleDate: true,
singleMonth: true,
language: lang,
format: 'DD.MM.YYYY',
startOfWeek: lang === 'en' ? 'sunday' : "monday",
showShortcuts: false,
batchMode: true
});
}
$('.header-slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
swipe: false,
arrows: true,
// autoplay: true,
// autoplaySpeed: 8000,
speed: 1000,
fade: true,
dots: false,
prevArrow: '<div class="slick-arrow slick-arrow-prev"></div>',
nextArrow: '<div class="slick-arrow slick-arrow-next"></div>',
responsive: [
{
breakpoint: 768,
settings: {
swipe: true,
}
}
]
});
$('.single-slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
prevArrow: '<div class="slick-arrow slick-arrow-prev"></div>',
nextArrow: '<div class="slick-arrow slick-arrow-next"></div>',
fade: true,
asNavFor: '.single-sub-slider'
});
$('.single-sub-slider').slick({
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.single-slider',
dots: false,
centerMode: true,
focusOnSelect: true,
arrows: false,
responsive: [
{
breakpoint: 768,
settings: {
arrows: false,
slidesToShow: 4,
}
},
]
});
});
/*
#placeholder
#mask
#arrow-forSlider
#points-forSlider
#left-arrow
#triangle-arrow
*/
/*
#points-forSlider
*/
.slick-dots{
position: absolute;
bottom: 10px;
left: 50%;
transform: translate(-50%, 0);
list-style-type: none;
padding: 0;
display: flex;
margin: 0;
}
.slick-dots li{
cursor: pointer;
height: 8px;
width: 8px;
background-color: #9b9b9b;
border-radius: 50%;
margin: 0 2px;
}
.slick-dots li.slick-active{
background-color: #29b35b;
}
/*
#arrow-forSlider
*/
.slick-arrow{
position: absolute;
top: 50%;
transform: translate(0, -50%);
z-index: 2;
padding: 10px;
cursor: pointer;
}
.arrow-form{
transition: all .3s;
transform: rotate(45deg);
width: 35px;
height: 35px;
border: 2px solid #29b35b;
}
.slick-arrow-prev{
left: 10px;
}
.slick-arrow-next{
right: 10px;
}
.slick-arrow-prev .arrow-form{
border-right: none;
border-top: none;
}
.slick-arrow-next .arrow-form{
border-left: none;
border-bottom: none;
}
/*
#mask
*/
.selector{
mask: url(../img/icons/ic_location.svg) no-repeat 50% 50%;
mask-size: cover;
-webkit-mask: url(../img/icons/ic_location.svg) no-repeat 50% 50%;
-webkit-mask-size: cover;
}
/*
#placeholder
*/
.input::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
opacity: 1; /* Firefox */
color: #ebfbff;
font-weight: 600;
}
.input::-ms-input-placeholder { /* Microsoft Edge */
color: #ebfbff;
font-weight: 600;
}
/*
#left-arrow
*/
a::before{
content: '';
border-left: 2px solid #2E2E2E;
border-bottom: 2px solid #2E2E2E;
height: 7px;
width: 7px;
position: absolute;
left: -2px;
top: 50%;
transform: translate(0, -50%) rotate(-45deg);
}
/*
#triangle-arrow
*/
a::before{
content: '';
position: absolute;
/*transform: rotate(45deg);*/
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 5px solid #38c8ee;
left: 0;
top: 10px;
}
$('selector').slick({
slidesToShow: 4,
slidesToScroll: 4,
swipe: false,
arrows: true,
speed: 600,
infinity: true,
dots: false,
prevArrow: '<div class="slick-arrow slick-arrow-prev"><div class="arrow-form"></div></div>',
nextArrow: '<div class="slick-arrow slick-arrow-next"><div class="arrow-form"></div></div>',
responsive: [
{
breakpoint: 870,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
}
},
{
breakpoint: 768,
settings: {
swipe: true,
slidesToShow: 2,
slidesToScroll: 2,
}
}
]
});
/* <div class="toggle-menu-wrap"> <a href="#" class='toggle-menu'><span></span></a> </div> */
/*************** CSS ***************/
.toggle-menu {
display: block;
width: 28px;
height: 30px;
padding-top: 12px;
}
.toggle-menu span:after,
.toggle-menu span:before {
content: "";
position: absolute;
left: 0;
top: -9px;
}
.toggle-menu span:after{
top: 9px;
}
.toggle-menu span {
position: relative;
display: block;
}
.toggle-menu span,
.toggle-menu span:after,
.toggle-menu span:before {
width: 100%;
height: 5px;
background-color: #888;
transition: all 0.3s;
backface-visibility: hidden;
border-radius: 2px;
}
/* on activation */
.toggle-menu.on span {
background-color: transparent;
}
.toggle-menu.on span:before {
transform: rotate(45deg) translate(5px, 5px);
}
.toggle-menu.on span:after {
transform: rotate(-45deg) translate(7px, -8px);
}
/*************** SASS ***************/
.toggle-menu
display: block
min-width: 30px
width: 30px
height: 30px
padding-top: 14px
margin-left: auto
margin-right: 5px
span:after, span:before
content: ""
position: absolute
left: 0
top: -9px
span:after
top: 9px
span
position: relative
display: block
span,
span:after,
span:before
width: 100%
height: 4px
background-color: #888
transition: all 0.3s
backface-visibility: hidden
border-radius: 1px
&.on span
background-color: transparent
&:before
transform: rotate(45deg) translate(5px, 5px)
&:after
transform: rotate(-45deg) translate(7px, -8px)
/*************** SCSS ***************/
.toggle-menu {
display: block;
width: 28px;
height: 30px;
padding-top: 12px;
span:after, span:before{
content: "";
position: absolute;
left: 0;
top: -9px;
}
span:after{
top: 9px;
}
span {
position: relative;
display: block;
}
span,
span:after,
span:before {
width: 100%;
height: 4px;
background-color: #888;
transition: all 0.3s;
backface-visibility: hidden;
border-radius: 1px;
}
&.on span{
background-color: transparent;
&:before{
transform: rotate(45deg) translate(5px, 5px);
}
&:after{
transform: rotate(-45deg) translate(7px, -8px);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment