$(document).ready(function(){
	
	"use strict";

	//Sticky_nav 	
			$(".menu").sticky({topSpacing:0});

	// //Mean menu js
  jQuery(document).ready(function () {
    jQuery('.main-menu').meanmenu({
      meanScreenWidth:"992", 
      meanMenuContainer: '.r-menu-generator',
    });
  });
  
  //jQuery Counter
    $('.counter').counterUp({
        time : 3000
    });
	 // Classes Slider 
	 $('.classes-slider').owlCarousel({
        loop:true,
        margin:10,
        nav:true,
        dots:false,
        autoplay:false, 
        animateIn: "fadeIn",
        animateOut: "fadeOut",
        navText: ['<i class="fa fa-angle-left" aria-hidden="true">', '<i class="fa fa-angle-right" aria-hidden="true">'],
        responsive:{
          0:{
            items:1
          },
          600:{
            items:3
          },
          1000:{
            items:3
          }
        }
    })
    // Services Area
    var $grid = $('.grid').isotope({
        itemSelector: '.grid-item',
        percentPosition: true,
        masonry: {
          columnWidth : '.grid-item'
        }
      });
          var filterFns = {
            numberGreaterThan50: function() {
              var number = $(this).find('.number').text();
              return parseInt( number, 10 ) > 50;
            },
            ium: function() {
              var name = $(this).find('.name').text();
              return name.match( /ium$/ );
            }
          };
    
          $('.filters-button-group').on( 'click', 'button', function() {
            var filterValue = $( this ).attr('data-filter');
            filterValue = filterFns[ filterValue ] || filterValue;
            $grid.isotope({ filter: filterValue });
          });
    
          $('.button-group').each( function( i, buttonGroup ) {
        var $buttonGroup = $( buttonGroup );
            $buttonGroup.on( 'click', 'button', function() {
              $buttonGroup.find('.is-checked').removeClass('is-checked');
              $( this ).addClass('is-checked');
            });
      });

      //======== video popup==========
      $('.video-play a').magnificPopup({
        type: 'iframe',
        iframe: {
            markup: '<div class="mfp-iframe-scaler">' +
                '<div class="mfp-close"></div>' +
                '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
                '</div>',
            patterns: {
                youtube: {
                    index: 'youtube.com/',
                    id: 'v=',
                    src: 'https://www.youtube.com/embed/%id%?autoplay=1'
                }
            },
            srcAction: 'iframe_src'
        }
    });

  // Classes Slider 
  let sliderCarousel = (className, itemsNo, isnavText=false, dots=false, center=false)=>(
    $(className).owlCarousel({
      loop:true,
      margin:10,
      nav:true,
      dots:dots,
      autoplay:1000,
      center: center,
      animateIn: "fadeIn",
      animateOut: "fadeOut",
      navText: isnavText ?['<i class="fa fa-angle-left" aria-hidden="true">', '<i class="fa fa-angle-right" aria-hidden="true">']:[],
      responsive:{
        0:{
          items:1
        },
        600:{
          items:1
        },
        1000:{
          items:itemsNo
        }
      }
  })
  )
  sliderCarousel('.service-review', 3, false, true, true)
  sliderCarousel('.review-slider', 2, true)
  

  //Owl-demo
    $("#owl-demo").owlCarousel({
        navigation : true, // Show next and prev buttons
        slideSpeed : 300,
        paginationSpeed : 400,
        items : 1, 
        itemsDesktop : false,
        itemsDesktopSmall : false,
        itemsTablet: true,
        itemsMobile : true
   
    });

    //Clients Slider
    $('.clients-slider').owlCarousel({
      stagePadding:0,
      loop: true,
      margin: 20,
      autoWidth: true,
      autoplay: true,
      nav: false,
      dots: false,
      responsive: {
          0: {
              items:1
          },
          600: {
              items:1
          },
          1000: {
              items:6
          }
      }
  })

    //Testimonial Carousel 
    $('.says_content').slick({
        slidesToShow: 1,
        slidesToScroll: 1,
        arrows: false,
        prevArrow: "",
        nextArrow: "",
        dots: false,
        fade: true,
        asNavFor: '.says_info'
    });
    $('.says_info').slick({
        fade: false,
        slidesToShow: 3,
        slidesToScroll: 3,
        asNavFor: '.says_content',

        dots: false,
        centerMode: true,
        focusOnSelect: true,
        variableWidth: false,
        prevArrow: '<button class="slide-arrow slick-prev"></button>',
        nextArrow: '<button class="slide-arrow slick-next"></button>',
        arrows: true,
        responsive: [
            {
              breakpoint: 991,
              settings: {
                slidesToShow: 3
              }
            },
            {
              breakpoint: 480,
              settings: {
                slidesToShow: 1
              }
            }
        ]
    }); 
  
    //Home Two Case Study Carousel 
    const leftArrow='<img src="./images/hometwo/h2leftarrow.png" alt:"leftarrow">';
    const rightArrow='<img src="./images/hometwo/h2rightarrow.png" alt:"rightarrow">';
    $('.h2csslider').owlCarousel({
      stagePadding:0,
      loop: true,
      margin: 20,
      autoWidth: true,
      autoplay: true,
      nav: true,
      navText: [leftArrow, rightArrow],
      dots: false,
      responsive: {
          0: {
              items:1
          },
          600: {
              items:1
          },
          1000: {
              items:6
          }
      }
  })
  
});
    
