123movies-seo/resources/js/bootstrap.js

118 lines
3 KiB
JavaScript
Raw Permalink Normal View History

2024-08-24 23:08:42 +03:00
'use strict';
// Import our custom CSS
// import '../scss/app.scss'
// Import all of Bootstrap's JS
2024-08-26 04:25:22 +03:00
// import * as bootstrap from 'bootstrap'
2024-08-24 23:08:42 +03:00
import * as bootstrap from 'bootstrap'
import * as Popper from '@popperjs/core'
// import { Tooltip, Toast, Popover, To } from 'bootstrap';
2024-08-25 21:58:11 +03:00
// import 'jquery'
2024-08-26 04:25:22 +03:00
// import 'bootstrap'
2024-08-24 23:08:42 +03:00
window.Popper = Popper
2024-08-26 20:50:06 +03:00
2024-08-24 23:08:42 +03:00
// menu options custom affix
var fixed_top = $(".header");
$(window).on("scroll", function(){
if( $(window).scrollTop() > 50){
fixed_top.addClass("animated fadeInDown menu-fixed");
}
else{
fixed_top.removeClass("animated fadeInDown menu-fixed");
}
});
$('.navbar-toggler').on('click', function (){
$('.header').toggleClass('active');
});
$('.nav-right__search-btn').on('click', function(){
$('.header-search-area').addClass('active');
2024-08-28 01:03:34 +03:00
$("input:text:visible:first").trigger('focus');
2024-08-24 23:08:42 +03:00
});
//close when click off of container
2024-08-26 20:50:06 +03:00
$(document).on('click', function (e){
if (!$(e.target).is('.nav-right__search-btn, .nav-right__search-btn *, .header-search-form, .header-search-form *')) {
2024-08-24 23:08:42 +03:00
$('.header-search-area').removeClass('active');
}
});
2024-08-28 01:03:34 +03:00
$(".search-bar > a").on("click", function () {
$(".header-top-search-area").slideToggle();
});
2024-08-24 23:08:42 +03:00
// mobile menu js
$(".navbar-collapse>ul>li>a, .navbar-collapse ul.sub-menu>li>a").on("click", function() {
const element = $(this).parent("li");
if (element.hasClass("open")) {
element.removeClass("open");
element.find("li").removeClass("open");
}
else {
element.addClass("open");
element.siblings("li").removeClass("open");
element.siblings("li").find("li").removeClass("open");
}
});
// Animate the scroll to top
$(".scroll-to-top").on("click", function(event) {
event.preventDefault();
$("html, body").animate({scrollTop: 0}, 300);
});
//preloader js code
2024-08-26 20:50:06 +03:00
$("#preloader").delay(200).animate({
2024-08-24 23:08:42 +03:00
"opacity" : "0"
}, 300, function() {
$("#preloader").css("display","none");
});
$(function () {
$('[data-toggle="tooltip"]').tooltip()
2024-08-26 20:50:06 +03:00
})
2024-08-24 23:08:42 +03:00
///lazy loading image script
2024-08-26 04:25:22 +03:00
/* function lazyLoading(){
2024-08-24 23:08:42 +03:00
let images = document.querySelectorAll('.loading-img');
function preloadImage(image) {
let src = image.getAttribute('data-src');
image.setAttribute('src', src)
image = $(image);
image.siblings('.thumb_overlay').fadeTo(2500, 0)
}
let imageOptions = {
threshold: 1,
};
const imageObserver = new IntersectionObserver((entries, imageObserver) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
// setTimeout(() => {
preloadImage(entry.target)
// overlay.style.display = 'none';
// }, 2000);
imageObserver.unobserve(entry.target)
}
})
}, imageOptions)
images.forEach(image => {
imageObserver.observe(image)
}, imageOptions)
}
2024-08-26 04:25:22 +03:00
lazyLoading(); */
2024-08-24 23:08:42 +03:00
2024-08-26 04:25:22 +03:00
// (function ($) {
// "user strict";
2024-08-24 23:08:42 +03:00
// Search options
2024-08-28 01:03:34 +03:00
2024-08-26 04:25:22 +03:00
// })($);
2024-08-24 23:08:42 +03:00