TanchoToplineCargo/public/humancarerecruit/js/custom.js
2024-05-05 10:32:49 +05:45

169 lines
3.9 KiB
JavaScript

$(".js-select2-dela").select2({
placeholder: "Select Tags",
width: 'resolve',
theme: "classic"
});
function checkScroll() {
var startY = $('.navbar').height() * 0.1; //The point where the navbar changes in px
if ($(window).scrollTop() > startY) {
$('.navbar').addClass("scrolled");
} else {
$('.navbar').removeClass("scrolled");
}
}
if ($('.navbar').length > 0) {
$(window).on("scroll load resize", function () {
checkScroll();
});
}
// When the user scrolls down 80px from the top of the document, resize the navbar's padding and the logo's font size
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 40) {
document.getElementById("navbar_top").style.padding = "0px 10px";
} else {
document.getElementById("navbar_top").style.padding = "0px 10px";
}
}
/** Owl Carousel */
$(document).ready(function () {
var silder = $("#clients");
silder.owlCarousel({
autoplay: true,
autoplayTimeout: 4000,
autoplayHoverPause: false,
items: 1,
stagePadding: 20,
center: false,
nav: false,
margin: 30,
loop: true,
responsive: {
0: { items: 1 },
480: { items: 1 },
575: { items: 1 },
768: { items: 2 },
991: { items: 3 },
1200: { items: 5 }
}
});
});
$(document).ready(function () {
var silder = $(".owl-carousel");
silder.owlCarousel({
autoplay: true,
autoplayTimeout: 4000,
autoplayHoverPause: false,
items: 1,
stagePadding: 20,
center: false,
nav: false,
margin: 30,
loop: true,
responsive: {
0: { items: 1 },
480: { items: 1 },
575: { items: 1 },
768: { items: 2 },
991: { items: 3 },
1200: { items: 3 }
}
});
});
$(document).ready(function () {
var silder = $("#category");
silder.owlCarousel({
autoplay: true,
autoplayTimeout: 4000,
autoplayHoverPause: false,
items: 1,
stagePadding: 20,
center: false,
nav: false,
margin: 30,
loop: true,
responsive: {
0: { items: 1 },
480: { items: 1 },
575: { items: 1 },
768: { items: 2 },
991: { items: 3 },
1200: { items: 3 }
}
});
});
var owl = $('#category');
owl.owlCarousel();
// Go to the next item
$('.customNextBtn').click(function() {
owl.trigger('next.owl.carousel');
})
// Go to the previous item
$('.customPrevBtn').click(function() {
// With optional speed parameter
// Parameters has to be in square bracket '[]'
owl.trigger('prev.owl.carousel', [300]);
})
// make it as accordion for smaller screens
if (window.innerWidth > 992) {
document.querySelectorAll('.navbar .nav-item').forEach(function (everyitem) {
everyitem.addEventListener('mouseover', function (e) {
let el_link = this.querySelector('a[data-bs-toggle]');
if (el_link != null) {
let nextEl = el_link.nextElementSibling;
el_link.classList.add('show');
nextEl.classList.add('show');
}
});
everyitem.addEventListener('mouseleave', function (e) {
let el_link = this.querySelector('a[data-bs-toggle]');
if (el_link != null) {
let nextEl = el_link.nextElementSibling;
el_link.classList.remove('show');
nextEl.classList.remove('show');
}
})
});
}
/* To Top Button */
let mybutton = document.getElementById("myBtn");
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 80) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
/*Pagination*/