
/*---------------Page Loder ----------------*/

setTimeout(function () {
  var loder = document.querySelector('.loader-bg');
  document.body.removeChild(loder);
}, 1500);

/*----X-------------Page Loder --------X------*/

/*--------cta button ripple animation ------*/
$(function () {

  //creating a style object for the ripple effect
  function RippleStyle(width, height, posX, posY) {
    this.width = (width <= height) ? height : width;
    this.height = (width <= height) ? height : width;
    this.top = posY - (this.height * 0.5);
    this.left = posX - (this.width * 0.5);
  }

  $('.cta-btn').on('mousedown', function (e) {
    e.preventDefault();
    //appending an element with a class name "btn-ripple"
    var rippleEl = $('<span class="btn-ripple"></span>').appendTo(this);

    //getting the button's offset position
    var pos = $(this).offset();

    //get the button's width and height
    var width = $(this).outerWidth();
    var height = $(this).outerHeight();

    //get the cursor's x and y position within the button
    var posX = e.pageX - pos.left;
    var posY = e.pageY - pos.top;

    //adding a css style to the ripple effect
    var rippleStyle = new RippleStyle(width, height, posX, posY);
    rippleEl.css(rippleStyle);
  });

  //this event listener will be triggered once the ripple animation is done
  $('.cta-btn').on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', '.btn-ripple', function () {
    $(this).remove();
  });
});
/*----X----cta button ripple animation ---X---*/
/*--------cta button click ---------*/
// var ctaBtn = document.querySelector('.cta-btn');


// ctaBtn.addEventListener('click' , gotoContact);

// function gotoContact(){
//   location.href = '#contact';
  
// }




/*---X-----cta button click ----X-----*/






/*---------Toggle Menu  (hamburger using jquery)------------- */
$(document).ready(function () {
  $('.icon, a').click(function () {
    $('.icon').toggleClass('active');
    $('nav ul').toggleClass('action');

  });

});


/*----X-----Toggle Menu(hamburger)-------X------ */


/*-------------navbar related animation(using gsap)--------*/


// TweenMax.staggerFrom(" .logo , nav ul li", 0.5, { opacity: 0, y: 200, delay: 1.5 }, 0.2);
// TweenMax.staggerFrom("#home h2 , #home h1 , #home button", 1.5, { opacity: 0, y: 200, delay: 3 }, 1.2);

/*-----X--------navbar related animation(using gsap)----X----*/

/*----------------Full page Scrolling Animation---------*/
// window.sr = ScrollReveal();
// sr.reveal('.left-col', {
//   duration: 400,
//   origin:'left',
//   viewFactor: 0.2,
//    distance:'0px'
// });
// sr.reveal('#about .about-title', {
//   delay: 410,
//   duration: 450,
//   origin:'bottom',
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('.slogan-text', {
//   delay: 800,
//   duration: 500,
//   origin:'bottom',
//   viewFactor: 0.2,
//    distance:'50px'
// });


// sr.reveal('.cover', {
//   delay: 710,
//   duration: 500,
//   opacity:0.1,
//   viewFactor: 0.2,
//    distance:'0px'
// });
// sr.reveal('.right-col', {
//   delay: 1000,
//   duration: 500,
//   opacity:0.2,
//   viewFactor: 0.2,
  
// });
// sr.reveal('.upper', {
//   delay: 1100,
//   duration: 500,
//   opacity:0.2,
//   viewFactor: 0.2,
 
// });
// sr.reveal('.bottom', {
//   delay: 1200,
//   duration: 400,
//   opacity:0.2,
//   viewFactor: 0.2,
  
// });
// sr.reveal(' * .section-title', {
//   delay: 400,
//   duration: 800,
//   origin:'bottom',
//   viewFactor: 0.2,
//    distance:'50px'
// });


// sr.reveal('#services  .service-box', {
  
//   delay: 800,
//   duration: 500,
//   opacity:0.2,
//   viewFactor: 0.2,
//    distance:'0px'
// });

// sr.reveal('#services  .sevice-icon-holder, .service-title, .service-decription ', {
//   delay: 1000,
//   duration: 1000,
//   origin:'bottom',
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('.button-group', {
//   delay: 600,
//   duration: 1000,
//   origin:'bottom',
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('.our-project', {
//   delay: 600,
//   duration: 1000,
//   opacity:0,
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('.contact-form', {
//   delay: 100,
//   duration: 300,
//   opacity:0,
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('.social-network', {
//   delay: 300,
//   duration: 1000,
//   opacity:0,
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('.footer-text', {
//   delay: 400,
//   duration: 1100,
//   opacity:0,
//   viewFactor: 0.2,
//    distance:'50px'
// });
// sr.reveal('#contact', {
//   delay: 400,
//   duration: 600,
//   opacity:0,
//   viewFactor: 0.2,
//    distance:'50px'
// });

/*----X-----------Full page Scrolling Animation----X--*/


/*-------navbar color change on scroll -----*/
var nav = document.querySelector('nav');
var a = document.querySelectorAll('nav ul li a');
document.addEventListener('scroll', navBgChange);
function navBgChange() {
  if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
    nav.className = "navbarChange";

    a.forEach(function (link) {
      link.className = "navColChange";
    });
  } else {
    nav.className = "";
    a.forEach(function (link) {
      link.className = "";
    });
  }
}

/*---X----navbar color change on scroll ---X--*/

/*------------About page section -----------*/
// 



/*-----X-------About page section -----X------*/

/*---------Service Section ----------------*/



/*----X-----Service Section --------X--------*/

/*----------Portfolio Section ------------*/

$(document).ready(function () {


  let $btns = $('.project-area .button-group button');


  $btns.click(function (e) {

    $('.project-area .button-group button').removeClass('active');
    e.target.classList.add('active');

    let selector = $(e.target).attr('data-filter');
    $('.project-area .grid').isotope({
      filter: selector
    });

    return false;
  })

  $('.project-area .button-group #btn1').trigger('click');

});
 

/*-------------------project info----------------------------*/
var projects = document.querySelectorAll('.project-area .grid .our-project .img');
var projectTitle = document.querySelector('.project-area .grid .our-project .img .project-title');
var infoWrappers = document.querySelectorAll('.info-wrapper');
var imgs = document.querySelectorAll('.projectimg');
var closeBtns = document.querySelectorAll('.close-btn');
var viewDemo = document.querySelectorAll('.view-demo');

imgs.forEach(img => {

  img.onclick = function () {

    this.children[1].classList.toggle('displayToggle');
  
  
  }

});

var demos = [...viewDemo];
demos.map(demo => demo.addEventListener('click' , function(e) {
   e.stopPropagation();
}));


/*-------X------------project info---------------X-------------*/
/*----X------Portfolio Section --------X----*/



/*----X------open contact form from modal --------X----*/


var contactForm = document.querySelector('.registration-box');
var modalBody = document.querySelector('.modal-body');
const content = document.querySelector('.modal-content');


function myFunction(){
  console.log('hello');
  modalBody.style.display = 'none';
  contactForm.style.display = 'block';

}

/*----X------back to previous form from modal --------X----*/

var back = document.querySelector('.btn-back');
back.addEventListener('click', function(){
  modalBody.style.display = 'block';
  contactForm.style.display = 'none';
})