jQuery(document).ready(function($) {
$("[js-parallax-scene]").each(function(i, scene) {
var parallax = new Parallax(scene);
});
$('.features_carousel').on('init', function(){
sliderAdaptiveHeight($(this));
})
$('.features_carousel').on('afterChange', function(){
sliderAdaptiveHeight($(this));
});
var sliderAdaptiveHeight = function(obj){
var heights = [];
obj.find('.slick-active').each(function(){
heights.push($(this).height());
});
obj.find('.slick-list').css({transition: 'height .8s ease 0s'}).height(Math.max.apply(null, heights));
}
$('.features_carousel').slick({
arrows: true,
dots: true,
slidesToShow: 3,
slidesToScroll: 3,
adaptiveHeight: false,
responsive: [
{
breakpoint: 767,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
adaptiveHeight: true
}
}
]
});
if ($('body').width() < 767) {
$('.offers-list').slick({
arrows: true,
dots: true,
slidesToShow: 1,
slidesToScroll: 1
});
} else {
if ($(".offers-list").hasClass('slick-initialized')) {
$(".offers-list").slick('unslick');
}
}
$(window).resize(function(){
if ($('body').width() < 767) {
$('.offers-list').slick({
arrows: true,
dots: true,
slidesToShow: 1,
slidesToScroll: 1
});
} else {
if ($(".offers-list").hasClass('slick-initialized')) {
$(".offers-list").slick('unslick');
}
}
});
$('.desktop-carousel').slick({
arrows: true,
dots: false,
infinite: false,
slidesToShow: 1,
slidesToScroll: 1
});
$('.mobile-carousel').slick({
arrows: true,
dots: false,
infinite: false,
slidesToShow: 1,
slidesToScroll: 1
});
$('.advantage-item').click(function(e){
$('.advantage-active').removeClass('advantage-active')
$(this).addClass('advantage-active')
})
});
function btn_login(){
$('.btn_registration').click()
}
(function(window) {
var play = $('.video_text'),
preview = $('.video_img, .dark_cover');
var XT = XT || {};
play.on('click', function(){
$('iframe#top_video[data-src]').attr('src', $('iframe#top_video[data-src]').attr('data-src') )
})
window.onYouTubeIframeAPIReady = function() {
setTimeout(XT.yt.onYouTubeIframeAPIReady, 100);
};
XT.yt = {
/* load the YouTube API first */
loadApi: function() {
var j = document.createElement("script"),
f = document.getElementsByTagName("script")[0];
j.src = "//www.youtube.com/iframe_api";
j.async = true;
f.parentNode.insertBefore(j, f);
console.log('API Loaded');
},
/*default youtube api listener*/
onYouTubeIframeAPIReady: function() {
console.log('API Ready?');
window.YT = window.YT || {};
if (typeof window.YT.Player === 'function') {
player = new window.YT.Player('top_video', {
playerVars: {
controls: '0',
disablekb: '0',
rel: '0',
showinfo: '0'
},
events: {
onStateChange: XT.yt.onPlayerStateChange,
onError: XT.yt.onPlayerError,
onReady: XT.yt.onPlayerReady,
onStop: XT.yt.onPlayerStop
}
});
}
},
onPlayerReady: function() {
player.setVolume(50);
/* set volume to 1 (accepts 0-100) */
play.on('click', function() {
player.playVideo();
});
},
onPlayerStateChange: function(e) {
//do something on video ends
if (e.data === YT.PlayerState.ENDED) {
player.stopVideo();
preview.css('visibility', 'visible');
play.css('visibility', 'visible');
$('#top_video').hide();
}
},
init: function() {
this.loadApi();
}
};
XT.yt.init();
})(window);
jQuery(function($) {
$('input[placeholder], textarea[placeholder]').placeholder();
$(document).ready(function() {
$('body').on('click', '.toggle-spoiler>a', function(e){
e.preventDefault()
var active = $(this).closest('.toggle-spoiler').hasClass('active')
if(!active){
$(this).closest('.toggle-spoiler').addClass('active').children('div').show(500)
}else{
$(this).closest('.toggle-spoiler').removeClass('active').children('div').hide(600)
}
})
$('.homepage-slider').slick({
arrows: true,
prevArrow: $('.carousel-control.left'),
nextArrow: $('.carousel-control.right'),
});
$('.custom-select').each(function() {
var $this = $(this),
numberOfOptions = $(this).children('option').length;
$this.addClass('custom-select-hidden');
$this.wrap('
');
$this.after('');
var $styledSelect = $this.next('div.custom-select-styled');
var val_selected = $this.children('option[selected]').val()
if(!val_selected){
val_selected = $this.children('option:first-child').val()
}
var text_selected = $this.children('option[selected]').text()
if(!text_selected){
text_selected = $this.children('option:first-child').text()
}
$styledSelect.text(text_selected).addClass(val_selected);
var $list = $('', {
'class': 'custom-select-options notranslate'
}).insertAfter($styledSelect);
for (var i = 0; i < numberOfOptions; i++) {
$('', {
text: $this.children('option').eq(i).text(),
rel: $this.children('option').eq(i).val()
}).appendTo($list);
}
var $listItems = $list.children('li');
$styledSelect.click(function(e) {
e.stopPropagation();
$('div.custom-select-styled.active').not(this).each(function() {
$(this).removeClass('active').next('ul.custom-select-options').hide();
});
var block = $(this).toggleClass('active').next('ul.custom-select-options')
block.toggle(function(){
if( block.is(':visible') ){
var max_height = $(window).height() - block.offset().top - 10
block.css('max-height', max_height+'px')
}
});
});
$listItems.click(function(e) {
e.stopPropagation();
//парсим параметры get url страницы
var params = window
.location
.search
.replace('?','')
.split('&')
.reduce(
function(p,e){
var a = e.split('=');
p[ decodeURIComponent(a[0])] = decodeURIComponent(a[1]);
return p;
},
{}
);
params.language = $(this).attr('rel');
var params_arr = []
$.each(params, function(i,v){
if(i.length > 0){
params_arr.push(i+'='+v)
}
})
window.location.href = window.location.origin + window.location.pathname + '?'+ params_arr.join('&')
$styledSelect.text($(this).text()).removeClass('active');
$this.val($(this).attr('rel'));
$list.hide();
//console.log($this.val());
});
$(document).click(function() {
$styledSelect.removeClass('active');
$list.hide();
});
});
// $(".nav").on("click", "a", function(event) {
// event.preventDefault();
// var id = $(this).attr('href'),
// top = $(id).offset().top;
// $('body,html').animate({ scrollTop: top }, 1000);
// });
$('.video_text').click(function() {
$(this).css('visibility', 'hidden').siblings('.video_img, .dark_cover').css('visibility', 'hidden');
$('#top_video').show();
});
});
$('.center').slick({
centerMode: true,
centerPadding: '0px',
slidesToShow: 3,
dots: true,
infinite: true,
centerMode: true,
slidesToShow: 3,
slidesToScroll: 3,
arrows: true,
responsive: [{
breakpoint: 992,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0px',
slidesToShow: 1
}
},
{
breakpoint: 768,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0px',
slidesToShow: 1
}
},
{
breakpoint: 480,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0px',
slidesToShow: 1
}
}
]
});
// add-open-class
$('.menu-icon').click(function() {
if ($(this).parent().is('.menu-open')) {
$(this).parent().removeClass('menu-open');
$('body').removeClass('menu-open-wrapper-page');
} else {
$(this).parent().addClass('menu-open');
$('body').addClass('menu-open-wrapper-page');
}
});
//zzz
$(document).ready(function() {
// $(".nav").on("click","a", function (event) {
// event.preventDefault();
// var id = $(this).attr('href'),
// top = $(id).offset().top();
// headerHeight = $('.fixed-menu').height();
// $.consoleLog(headerHeight);
// $('body,html').animate({scrollTop: top - headerHeight}, 1000);
// });
function scrollToElement(element, offset) {
$(element).click(function(e) {
var elementClick = $(this).attr("href");
var destination = $(elementClick).offset().top;
if (destination < 0) { destination = 0; }
$('html, body').animate({ scrollTop: destination - offset }, "slow");
e.preventDefault();
});
}
scrollToElement("a[href='#header']", 56);
scrollToElement("a[href='#advantage']", 56);
scrollToElement("a[href='#price']", 56);
scrollToElement("a[href='#carousel-wrp']", 56);
scrollToElement("a[href='#reviews']", 56);
scrollToElement("a[href='#login']", 76);
scrollToElement("a[href='#footer']", 56);
scrollToElement("a[href='#login-anchor']", 60);
$('.video_text').click(function() {
$(this).css('visibility', 'hidden').siblings('.video_img, .dark_cover').css('visibility', 'hidden');
$('#top_video').show();
});
});
$('.languagepicker').on('change', function() {
window.location.href = '/order/?language=' + this.value;
});
$(document).on('click', '.next-slider', function(e) {
e.preventDefault();
$('.reviews-slider .slick-next').click();
});
$(document).on('click', '.prev-slider', function(e) {
e.preventDefault();
$('.reviews-slider .slick-prev').click();
});
//zzz//
}); //end ready
//Plugin placeholder
(function(b, f, i) {
function l() { b(this).find(c).each(j) }
function m(a) { for (var a = a.attributes, b = {}, c = /^jQuery\d+/, e = 0; e < a.length; e++)
if (a[e].specified && !c.test(a[e].name)) b[a[e].name] = a[e].value; return b }
function j() { var a = b(this),
d;
a.is(":password") || (a.data("password") ? (d = a.next().show().focus(), b("label[for=" + a.attr("id") + "]").attr("for", d.attr("id")), a.remove()) : a.realVal() == a.attr("placeholder") && (a.val(""), a.removeClass("placeholder"))) }
function k() {
var a = b(this),
d, c;
placeholder = a.attr("placeholder");
b.trim(a.val()).length > 0 || (a.is(":password") ? (c = a.attr("id") + "-clone", d = b("").attr(b.extend(m(this), { type: "text", value: placeholder, "data-password": 1, id: c })).addClass("placeholder"), a.before(d).hide(), b("label[for=" + a.attr("id") + "]").attr("for", c)) : (a.val(placeholder), a.addClass("placeholder")))
}
var g = "placeholder" in f.createElement("input"),
h = "placeholder" in f.createElement("textarea"),
c = ":input[placeholder]";
b.placeholder = { input: g, textarea: h };
!i && g && h ? b.fn.placeholder = function() {} : (!i && g &&
!h && (c = "textarea[placeholder]"), b.fn.realVal = b.fn.val, b.fn.val = function() { var a = b(this),
d; if (arguments.length > 0) return a.realVal.apply(this, arguments);
d = a.realVal();
a = a.attr("placeholder"); return d == a ? "" : d }, b.fn.placeholder = function() { this.filter(c).each(k); return this }, b(function(a) { var b = a(f);
b.on("submit", "form", l);
b.on("focus", c, j);
b.on("blur", c, k);
a(c).placeholder() }))
})(jQuery, document, window.debug);
/*FIXES 24.08.2018*/
$(document).ready(function() {
$(document).on('mouseenter', '.trust-btn', function() {
$(this).parent().addClass('hover');
});
$(document).on('mouseleave', '.trust-btn', function() {
$(this).parent().removeClass('hover');
});
/* BEGIN FIXES 16.09.2018*/
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 5) {
$(".fixed-menu").addClass("is-active");
} else {
$(".fixed-menu").removeClass("is-active");
}
});
$(document).on('click', '.navbar-toggle', function() {
$('.overlay-menu').toggleClass('is-active');
$('body').toggleClass('is-fixed');
});
jQuery(function($) {
$(document).mouseup(function(e) { // событие клика по веб-документу
var div = $("#bs-example-navbar-collapse-1"); // тут указываем ID элемента
if (!div.is(e.target) // если клик был не по нашему блоку
&&
div.has(e.target).length === 0) { // и не по его дочерним элементам
$('.overlay-menu').removeClass('is-active');
$('body').removeClass('is-fixed');
$('.navbar-collapse').removeClass('in');
}
});
});
$(document).on('click', '.navbar-default .navbar-nav>li>a', function(e) {
if($(this).attr('href').search(/^#/) != -1){
e.preventDefault();
}
$('.overlay-menu').removeClass('is-active');
$('body').removeClass('is-fixed');
$('.navbar-collapse').removeClass('in');
});
$(document).on('click', '.open-advantages', function(e) {
e.preventDefault();
$('.our-advantages').addClass('is-open');
$(this).css('display', 'none');
$('.less-advantages').css('display', 'inline-block');
});
$(document).on('click', '.less-advantages', function(e) {
e.preventDefault();
$('.our-advantages').removeClass('is-open');
$(this).css('display', 'none');
$('.open-advantages').css('display', 'inline-block');
});
/* END FIXES 16.09.2018*/
});
/*FIXES 24.08.2018*/