$(function(){/*попап для страницы груповые занятия*/ var base_el= $('.page-service .r-list-service'); if(!base_el.length)return; base_el.find('a').click(function(e) { e.preventDefault(); var el= $(this); el.parent().addClass('loading'); $.post( '/index-ajax.php', { snippet: 'getServiceList', mode: 'getContent', docid: el.attr('href').substr(1) }, function(data){ if( data.status=='success' ){ $('#service-info').find('.group_name').html( data.field.pagetitle ) .end().find('.userlvl').html( data.field.longtitle ) .end().find('.text').html( data.field.content ); popup('#service-info', 575); } }, 'json' ) .always(function() { el.parent().removeClass('loading'); }); }); }); function popup(selector,width, obj){ obj= $.extend({ zanytie: '' }, obj); var popup= $(selector); $('.pop-up').removeClass('show'); // $('body').addClass('off'); $('.white-fone').show(300); popup.addClass('show') .find('[name=zanytie]').val( obj.zanytie ) resizePopup(popup); // $(selector).css({'margin-left':-(wd)/2+'px','width':wd+'px','perspective':(2*wd)+'px','margin-top':-($(selector).height())/2+'px'}); } $(function(){ var popup_timeId=0; $(window).resize(function(e) { clearTimeout(popup_timeId); popup_timeId= setTimeout(function(){ resizePopup($('.pop-up.show')); }, 500); }); }); function resizePopup(popup){ popup= $(popup); if( !popup.is(':visible') )return; popup.css("margin-left",-popup.outerWidth()/2); var body= $('body'); var wind= $(window); var wH= wind.height(); var pH= popup.height(); if ( wH <= pH ) { popup.removeClass("fixed") .css({ "margin-top": wind.scrollTop() }); /* body.css({ width: '100%', overflow:'auto' });*/ $('body').removeClass('off'); } else{ popup.addClass("fixed") .css("margin-top",- (pH/2)); $('body').addClass('off'); /* body.css({ width: body.width(), overflow:'hidden' });*/ } } (function($, undefined){ $(document).ready(function(){ $('.trainers-only').setHeightItems(); //paralaks $(window).scroll(function(){ var op = parseFloat(($(window).scrollTop()+0.00001)/1500); $('.header.main .bg .fone-h').css({'background':'rgba(0,0,0,'+op+')'}); $('.header.main .bg video').css({'transform':' translateY('+($(window).scrollTop()*0.4)+'px)'}); $('.header .small-bg ').css({'transform':' translateY('+($(window).scrollTop()*0.4)+'px)'}); }); //animate scroll $('.scroll').click(function(){ $('html, body').animate({ scrollTop: $('.wait').offset().top}, 500); }); //is if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { $('.header.main .bg video').remove(); $('.adr a').addClass('top'); } if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {$('.adr a').addClass('top');} $('.akcia .text .like .like-button').click(function(){ $(this).parent().find('.social').show(200); return false; }); $('.akcia .text .like .social .close').click(function(){ $(this).parent().hide(200); }); $('.article .left ul li').click(function(){ $(this).find('.hide').toggle(300); }); $('.open-video').click(function(){ $('body').addClass('off'); $('.fone .bx-wrapper').remove(); $('.fone video').remove(); $('.fone').append(''); $('.fone').show(300); $('.fone video').trigger('click'); return false; }); /*---------------------popup------------------------*/ $("[name=phone]").mask("+375(99) 999-99-99"); //close $('.pop-up .content .close').click(function(){ $('.pop-up').removeClass('show'); $('.white-fone').hide(300); $('body').removeClass('off'); }); $('.white-fone').click(function(){ $('.pop-up').removeClass('show'); $('.white-fone').hide(300); $('body').removeClass('off'); }); /*$('#zapis .button').click(function(){ popup('#zapis2',575); return false; });*/ $('.popup-form').click(function(){ popup('#form',575, {zanytie: $(this).data('zanytie')}); return false; }); $('.popup-sended').click(function(){ popup('#sended',575); return false; }); $('.popup-ask').click(function(){ console.log($(this).closest(".footer").length); if($(this).closest(".footer").length) { console.log("hello"); $("#quest input[name=abonement-name]").removeAttr("value"); } else { $("#quest input[name=abonement-name]").attr("value", $(this).attr("data-zanytie")); } popup('#quest',575); return false; }); $('.popup-msg-sended').click(function(){ popup('#msg-sended',575); return false; }); $('.popup-profile').click(function(){ var name = $(this).find('.name').text(); var desc = $(this).find('.desc').text(); var about = $(this).find('.about-info').html(); var ava = $(this).find('.ava').attr('src'); /*$(this).find('span').each(function(index, element) { if('none' !== $(this).css('display')){ ava = $(this).find('.ava').attr('src'); } });*/ $('#profile h2').html(name); $('#profile .big').html(desc); $('#profile .about-text').html(about); $('#profile .photo img').attr('src', ava); popup('#profile',760); return false; }); }); })(jQuery); $(function(){ /*СЛАЙДЕР и ТРЕНЕРА*/ if(typeof $('#slider').bxSlider != 'function')return; var middle = Math.floor($('#slider img').length/2); $('#slider div:nth-child('+(middle+1)+')').addClass('active-slide'); $('#slider div:nth-child('+(middle+1)+')').prev().addClass('left'); $('#slider div:nth-child('+(middle+1)+')').next().addClass('next'); var slider = $('#slider').bxSlider({ auto:true, pause:5000, pager:false, //infiniteLoop: false, onSliderLoad:function(){ $('#slider img').each(function(){ if($(this).height()>485){ $(this).css({'margin-top':-($(this).height()-485)/2+'px'}); } }); $('#slider div.bx-clone').each(function(i){ $(this).addClass('n-'+i); }); setTimeout(function (){ $('.trainers #trainers').setHeightItems(); }, 500); }, startSlide:middle, onSlideNext:function ($slideElement, oldIndex, newIndex) { $('#slider div').removeClass('next').removeClass('left').removeClass('active-slide'); $($slideElement).addClass('active-slide'); $($slideElement).prev().addClass('left'); $($slideElement).next().addClass('next'); //$('#slider div.n-0').addClass('active-slide'); if(newIndex==0){ $('#slider div.n-1').addClass('next').addClass('active-slide'); ; } }, onSlidePrev:function ($slideElement, oldIndex, newIndex) { $('#slider div').removeClass('next').removeClass('left').removeClass('active-slide'); $($slideElement).prev().addClass('left'); $($slideElement).next().addClass('next'); $($slideElement).addClass('active-slide'); if(oldIndex==1){ $('#slider div.n-1').addClass('next').addClass('active-slide'); ; $("#slider").css({"transform":"translate3d(-" + $('#slider').parent().width() + "px, 0, 0)"}); } if(oldIndex==0){ $('#slider div.n-0').next().addClass('next'); $('#slider div.n-0').addClass('active-slide'); } } }); var trainers = $('#trainers').bxSlider({ pager:true, infiniteLoop: false, startSlide:0, controls:false, minSlides:5, maxSlides:5, moveSlides:5, slideWidth:1000 }); $('.overlay, .fone .close').click(function(){ $('.overlay').hide(300); $('.fone').hide(300); $('body').removeClass('off'); $('.fone .bx-wrapper').remove(); $('.fone video').remove(); }); var gal; $('.gallery div').click(function(){ $('body').toggleClass('off'); var gal_cont = '
'; $('.gallery [data-image]').each(function(){ var src = $(this).data('image'); //gal_cont+= '
'+$(this).html()+'
'; gal_cont+= '
'; }); gal_cont+='
'; $('.fone .bx-wrapper').remove(); $('.fone video').remove(); $('.fone').show(300); $('.overlay').show(300); $('.fone').append(gal_cont); $('#gal div').attr('style',''); var middle =$(this).index(); var last = $('#gal div').length; $('#gal div:nth-child('+(middle+1)+')').addClass('active-slide'); $('#gal div:nth-child('+(middle+1)+')').prev().addClass('left'); $('#gal div:nth-child('+(middle+1)+')').next().addClass('next'); var gal = $('.fone #gal').bxSlider({ infiniteLoop: false, speed:500, pager:false, startSlide:middle, controls:false, onSliderLoad:function(){ /*$('#gal img').each(function(){ if($(this).height()>$(this).parent().height()){ $(this).css({'margin-top':-($(this).height()-$(this).parent().height())/2+'px'}); } });*/ var top = ($(window).height()-$('.fone .bx-wrapper').height())/2; $('.fone .bx-wrapper').css({'top':top+'px'}); }, onSlideNext:function ($slideElement, oldIndex, newIndex) { // var img = $slideElement.children('img'); // var prevImg = $slideElement.prev().children('img'); $('#gal div').removeClass('next').removeClass('left').removeClass('active-slide'); $($slideElement).addClass('active-slide'); $($slideElement).prev().addClass('left'); $($slideElement).next().addClass('next'); //$('#slider div.n-0').addClass('active-slide'); // prevImg.animate({width:'auto',height:50+'%',top:25+'%'},'slow'); // img.animate({width:'auto',height:100+'%',top:0},'slow'); }, onSlidePrev:function ($slideElement, oldIndex, newIndex) { // var img = $slideElement.children('img'); var nextImg = $slideElement.next().children('img'); $('#gal div').removeClass('next').removeClass('left').removeClass('active-slide'); $($slideElement).prev().addClass('left'); $($slideElement).next().addClass('next'); $($slideElement).addClass('active-slide'); // // nextImg.css({'margin-top':'auto'}); // img.animate({width:'auto',height:100+'%',top:0},'slow'); // if(oldIndex==1){ $('#gal div.n-1').addClass('next').addClass('active-slide'); ; $("#gal").css({"transform":"translate3d(-" + $('#gal').parent().width() + "px, 0, 0)"}); } if(oldIndex==0){ $('#gal div.n-0').next().addClass('next'); $('#gal div.n-0').addClass('active-slide'); } // } // onSlideAfter:function(){ // // // } }); $('body').on('click','.fone #gal div.left',function(){ $('.fone #gal div img').removeClass('fullWidth').css({'margin-top':'auto'}); var img = $('#gal div.active-slide').prev().find('img'); var cont =img.parent(); var chek =false; // if(img.width()>cont.width()){ // img.addClass('fullWidth'); // chek=true; // } gal.goToPrevSlide(); if(chek==true){ img.css({'margin-top':-(img.height()/2)+'px'}); } return false; }); $('body').on('click','.fone #gal div.next',function(){ $('.fone #gal div img').removeClass('fullWidth').css({'margin-top':'auto'}); var img = $('#gal div.active-slide').prev().find('img'); var cont =img.parent(); var chek =false; // if(img.width()>cont.width()){ // img.addClass('fullWidth'); // chek=true; // } gal.goToNextSlide(); if(chek==true){ img.css({'margin-top':-(img.height()/2)+'px'}); } return false; }); }); }); jQuery.fn.setHeightItems = function(){//для слайдера на главной и блочков наша команда return this.each(function(){ var base_el = $(this); if( !base_el.length )return; var items= base_el.find('.popup-profile'); var items_imgs= items.find('.r-item'); var first_el= items.filter(':first'); var funct= function(){ items_imgs.add(first_el.closest('.bx-viewport')).height( first_el.width() ); }; funct(); var time_id= 0; $(window).resize(function(){ clearTimeout(time_id); time_id= setTimeout(funct, 200); }); }) } $(document).ready(function(){ $('.like-button').on('click',function(){ var title = $(this).parent().find('.social-likes').data('title'); var metaTitle = $('[property="og:title"]').attr('content',title); console.log(metaTitle); }); $(".pop-up input[name=page-name]").attr("value", $("title").text()); });