 /**
   * The Custome Script.
   *
   *
   * @package   igor WordPress Theme
   * @copyright Copyright (C) 2016, OrdaSoft
   * @license  http://www.gnu.org/licenses/gpl-2.0.html  GNU General Public License v2 or later
   * @author    AUTHOR <www.ordasoft.com>
   * igor is distributed under the terms of the GNU GPL
   */
//menu
jQuery(document).ready(function (){

//slider
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 1,
        spaceBetween: 30,
        grabCursor: true,
        // pagination: '.swiper-pagination',
        // paginationClickable: true,
        // direction: 'vertical',
        loop: true
    });


    jQuery(window).scroll(function(){
      if(jQuery(window).scrollTop() >= 20) {
       jQuery('.top-section').addClass('top-section-fixed');
      } else {
       jQuery('.top-section').removeClass('top-section-fixed');
     }
    });

    jQuery(window).scroll(function(){
      if(jQuery(window).scrollTop() >= 20) {
       jQuery('.right-section').addClass('right-section-fixed');
      } else {
       jQuery('.right-section').removeClass('right-section-fixed');
     }
    });

     jQuery(window).scroll(function(){
          if(jQuery(window).scrollTop() >= 20) {
           jQuery('.bottom-section').addClass('bottom-section-fixed');
          } else {
           jQuery('.bottom-section').removeClass('bottom-section-fixed');
         }
        });

     jQuery(window).scroll(function(){
        if(jQuery(window).scrollTop() >= 20) {
         jQuery('.left-section').addClass('left-section-fixed');
        } else {
         jQuery('.left-section').removeClass('left-section-fixed');
       }
      });

     jQuery(window).scroll(function(){
        if(jQuery(window).scrollTop() >= 20) {
         jQuery('.for-menu').addClass('for-menu-fixed');
        } else {
         jQuery('.for-menu').removeClass('for-menu-fixed');
       }
      });

     jQuery(window).scroll(function(){
        if(jQuery(window).scrollTop() >= 20) {
         jQuery('.social-left').addClass('social-left-fixed');
        } else {
         jQuery('.social-left').removeClass('social-left-fixed');
       }
      });


//-------------------------***********************fixed sidebar
// var height_w = jQuery( window ).height();
// var height_s = jQuery( '#sidebar-left' ).height();
// if(height_s <= height_w) {
//   jQuery(window).scroll(function(){
//     if(jQuery(window).scrollTop() >= 50) {
//      jQuery( '#sidebar-left' ).addClass( "sidebar-fixed" );
//     } } )
// } else {
//   jQuery(window).scroll(function(){
//     if(jQuery(window).scrollTop(100)) {
//      jQuery( '#sidebar-left' ).removeClass( "sidebar-fixed" );
//     } } )
// }

//**************************************blog
 jQuery(".blog, .category-content, .tag-content, .search-content, .archive-content").width(function(i,val){
    var widthBlocks = val;
    if(widthBlocks >=668) {
        var widthItems = widthBlocks/3-1;
    } else if(widthBlocks >=414) {
        var widthItems = widthBlocks/2-2;
    }else {
        var widthItems = widthBlocks;
    }
    if(jQuery(".one-post")) {
        jQuery(".one-post").css({"width":widthItems,"left": 0})
    }
     if(jQuery(".two-post")) {
        jQuery(".two-post").css({"width":widthItems,"left": widthItems})
    }
    if(jQuery(".tree-post")) {
        jQuery(".tree-post").css({"width":widthItems,"left": widthItems*2})
    }
});

});

//tab
   jQuery('#myTab a').click(function (e) {
    e.preventDefault();
    jQuery(this).tab('show');
  })
  jQuery('#myTab a[href="#test"]').tab('show'); // Select tab by name
  jQuery('#myTab a:first').tab('show'); // Select first tab
  jQuery('#myTab a:last').tab('show'); // Select last tab
  jQuery('#myTab li:eq(0) a').tab('show'); // Select third tab (0-indexed)


//about us
( function( $ ) {


  var theToggle = document.getElementById('toggle');

    jQuery('.top-up').click(function(){
    jQuery("html, body").animate({ scrollTop: 0 }, 1100);
    return false;
  });

$(window).on('load', function () {
    var $preloader = $('#page-preloader'),
        $spinner   = $preloader.find('.sk-folding-cube');
    $spinner.fadeOut();
    $preloader.delay(350).fadeOut('slow');
});

} )( jQuery );