
//--- navbar -- //

document.addEventListener("DOMContentLoaded", function () {
  const header = document.querySelector(".nav-topbar");
  const toggleClass = "scroll-top-fixed";

  window.addEventListener("scroll", function () {

    if (window.scrollY > 50) {
      header.classList.add(toggleClass);
    } else {
      header.classList.remove(toggleClass);
    }
  });
});



//---- owl_carousel start ----//

$(document).ready(function() {
    $("#doctor-slider").owlCarousel({
        items : 4,
        itemsDesktop:[1199,4],
        itemsDesktopSmall:[980,2],
        itemsMobile : [600,1],
        navigation:true,
        navigationText:["",""],
        pagination:true,
        autoPlay:true
    });
});


//---- owl_carousel end ----//

//---- floating label start ----//

$('input,textarea').on('focus', function() { 
    $(this).parent().find('label').addClass('active');
      });
    $('input,textarea').on('focusout', function() {
    if (!this.value) {
      $(this).parent().find('label').removeClass('active');
    }
});

//---- floating label end ----//


//----- GSAP Scroll effect ----//

gsap.registerPlugin(ScrollTrigger);
gsap.utils.toArray(".parallax-scroll").forEach((section, i) => {
  ScrollTrigger.create({
    trigger: section,
    start: "top top",
    pin: true,
    pinSpacing: false,
    onUpdate: (self) => {
      const progress = self.progress; 
      gsap.to(section, { opacity: 1 - progress, overwrite: true });
    }
  });
});


// carousel appointment modal

// const carousel = Carousel('#carouselExampleFade', {
//   interval: false,
//   ride: 'carousel'
// });

// end

