$(document).ready(function(){ //Загрузка слайдов на главную страницу $.ajax({url: "/?slides", cache: false, async: true, success: function(slides){ $('.slides').append(slides); $('#main .slides li img').eq(0).on('load', function(){ $('#main .slides').fadeIn(600); $('.slides').responsiveSlides({ timeout: 6000, speed: 600, random: false, namespace: "slider", prevText: "", nextText: "", nav: false, pager: true, pause: true, before: function(){ $('#main .loading').remove(); } }); }) } }); $('.slider-link').on('click', function(){ location.href = $('.slides li.slider1_on a').attr('href'); }) //Загрузка слайдов на страницу спецпредложений $.ajax({url: "/?promo", cache: false, async: true, success: function(promo){ $('.promo').append(promo); $('#main .promo li img').eq(0).on('load', function(){ $('#main .promo').fadeIn(600); $('.promo').responsiveSlides({ timeout: 4500, speed: 600, namespace: "slider", prevText: "", nextText: "", nav: true, pager: true, before: function(){ $('#main .loading').remove(); } }); }) } }); //Плавающая подсказка в слайдах $('.slides-description').on('mouseenter', function(){ $('.slides-description').attr('show', '1'); $('.description-container .description').animate({ right: '+=402px' }, 600, 'easeOutQuint'); }) $('.slides-description').on('mouseout', function(){ if($(this).attr('show') != '0') $('.description-container .description').animate({ right: '-=402px' }, 580, 'easeInQuint', function(){ $('.slides-description').attr('show', '0'); $('.description-container .description').queue("fx", []) }); }) //Подписка на рассылку $('.subscribe').on('click', function(){ jQuery.facebox({ ajax: '/subscribe' }); }) //Выпадающее меню $('.mainmenu li').on('mouseenter', function(){ $(this).find('ul').slideDown({duration: 360, easing: 'easeOutQuint'}); }) $('.mainmenu li').on('mouseleave', function(){ $(this).find('ul').fadeOut({duration: 260, complete: function(){ $(this).queue("fx", []); }}); }) //Разворачивание блоков $('.vacancies li h2').on('click', function(){ if($(this).parent().find('div').attr('opened') == 0) { $(this).parent().find('h2 span').addClass("opened"); $(this).parent().find('div.description').slideDown({duration: 200, easing:'easeOutQuint', complete: function(){ $(this).attr('opened', '1'); }}); } else $(this).parent().find('div.description').slideUp({duration: 130, easing: 'easeInQuint', complete: function(){ $(this).attr('opened', '0'); $(this).parent().find('h2 span').removeClass("opened"); }}); }) $('.buy').on('click', function(){ jQuery.facebox({ ajax: '/avtomobili/buy' }); }) //Инициализация Fancybox $(".fancybox").fancybox(); }) function setCookie (name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(name) { var cookie = " " + document.cookie; var search = " " + name + "="; var setStr = null; var offset = 0; var end = 0; if (cookie.length > 0) { offset = cookie.indexOf(search); if (offset != -1) { offset += search.length; end = cookie.indexOf(";", offset) if (end == -1) { end = cookie.length; } setStr = unescape(cookie.substring(offset, end)); } } return(setStr); } function onloadGeneral(){ if(getCookie ("user") != "18.219.50.175") { $.facebox('
Подпишитесь на рассылку, чтобы быть в курсе последних новостей Лиги друзей!
'+result['text']+'
').animate({"opacity": "1"}, 400); }) } else if(result['result'] == 'errors') for (var field in result['errors']) $('#'+field+'_popup').css({'border':'1px solid red','border-radius':4}); } }) }