jQuery(document).ready(function($) {
/******* Інформація про зміну ширини вікна *******/
$('body').append('
')
$(this).find('.item').each(function(index, el) {
var th_text = $(this).text();
th_text = $.trim(th_text);
$('.mobile-tab .bottom').append('
' + th_text + '
')
});
});
$('.mobile-tab').each(function(index, el) {
var th_text = $(this).find('.bottom > div').first().text();
th_text = $.trim(th_text);
$(this).find('.top').text(th_text);
});
$('.mobile-tab .top').click(function(event) {
$(this).parents('.mobile-tab').find('.bottom').toggleClass('active');
});
$('.tabs-wr .top-tabs .item, .mobile-tab .bottom div').click(function(event) {
$(this).parents('.tabs-wr').find('.item').removeClass('active');
$(this).addClass('active');
var th_index = $(this).index();
$(this).parents('.tabs-wr').find('.bottom-tabs > .item').hide(0);
$(this).parents('.tabs-wr').find('.bottom-tabs > .item').eq(th_index).show(0);
});
$('.mobile-tab .bottom div').click(function(event) {
var th_text = $(this).text();
th_text = $.trim(th_text);
$(this).parents('.mobile-tab ').find('.top').text(th_text);
$(this).parents('.bottom').removeClass('active');
var th_index = $(this).index();
$('.tabs-wr .top-tabs .item').eq(th_index).addClass('active');
});
/*-----tabs-----*/
/*-----mobile menu-----*/
$('header ul.ul-nav > li').each(function(index, el) {
var th_length = $(this).find('ul').length;
if(th_length > 0){
$(this).find('> a').append('
');
}
});
$('header ul.ul-nav > li i').click(function(event) {
event.preventDefault();
$('header ul.ul-nav > li i').not($(this)).parents('li').find('ul').slideUp(400);
$(this).parents('li').find('ul').slideToggle(400);
});
$('.nav-click').click(function(event) {
$(this).toggleClass('active');
$('.wrapper').toggleClass('active');
$('html, body').toggleClass('overflow');
});
/*-----mobile menu-----*/
/*vertical slider*/
function function_acardion() {
var th_index = $('.acardion-vertical .item').last().index();
var th_width = $('.acardion-vertical .item.active .top').outerWidth();
var result = th_width * th_index;
$('body').append('');
$('.acardion-vertical .item.active .bottom').css('width', 'auto');
var width_bottom = $('.acardion-vertical .item.active .bottom').outerWidth();
$('.acardion-vertical .item .bottom').each(function(index, el) {
$(this).css('width', width_bottom + 'px');
});
$('body').append('')
}
function_acardion();
jQuery(window).resize(function() {
clearTimeout(window.resizedFinished);
window.resizedFinished = setTimeout(function(){
function_acardion();
}, 100);
});
$('.acardion-vertical .item').click(function(event) {
$('.acardion-vertical .item').removeClass('active');
$(this).addClass('active');
});
/*vertical slider*/
/*agency-items*/
var time_animation = 800;
$('.agency-items .item').hover(function() {
// зупинка анімації
$(this).find('.img').stop();
$(this).find('.text-block').stop();
var_th_height = $(this).find('.text-block').outerHeight();
var_th_height = var_th_height + 10;
$(this).find('.img').animate({'top':'-' + var_th_height + 'px'}, time_animation, "easeOutBounce");
$(this).find('.text-block').animate({'top':'0'}, time_animation, "easeOutCubic");
}, function() {
// зупинка анімації
$(this).find('.img').stop();
$(this).find('.text-block').stop();
$(this).find('.img').animate({'top': '0px'}, time_animation, "easeOutBounce")
$(this).find('.text-block').animate({'top':'100%'}, time_animation, "easeOutCubic");
return false;
});
/*agency-items*/
/* srarch header */
$('.search-header input').focus(function(event) {
$('.search-header').animate({'width': '250px'}, 200);
});
$('.search-header input').focusout(function(event) {
$('.search-header').animate({'width': '151px'}, 200);
});
/* srarch header */
/* lists-acardion */
$('.lists-acardion .acardion-in .top').click(function(event) {
$('.lists-acardion .acardion-in .top').not($(this)).parents('.acardion-in').find('.bottom').slideUp(400);
$(this).parents('.acardion-in').find('.bottom').slideToggle(400);
});
/* lists-acardion */
});