$(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: 4500, speed: 600, random: false, namespace: "slider", prevText: "", nextText: "", nav: false, pager: 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(); })