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

127 lines
3.5 KiB
JavaScript

'use strict';
// Import our custom CSS
// import '../scss/app.scss'
// Import all of Bootstrap's JS
// import * as bootstrap from 'bootstrap'
import * as bootstrap from 'bootstrap'
import * as Popper from '@popperjs/core'
// import { Tooltip, Toast, Popover, To } from 'bootstrap';
// import 'jquery'
// import 'bootstrap'
window.Popper = Popper
// import {Alert} from 'bootstrap'
// import Alert from "./js/dist/alert";
// import Button from "./js/dist/button";
// import Carousel from "./js/dist/carousel";
// import Collapse from "./js/dist/collapse";
// import Dropdown from "./js/dist/dropdown";
// import Modal from "./js/dist/modal";
// import Offcanvas from "./js/dist/offcanvas";
// import Popover from "./js/dist/popover";
// import ScrollSpy from "./js/dist/scrollspy";
// import Tab from "./js/dist/tab";
// import Toast from "./js/dist/toast";
// import Tooltip from "./js/dist/tooltip";
// 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');
});
//close when click off of container
$(document).on('click touchstart', function (e){
if (!$(e.target).is('.nav-right__search-btn, .nav-right__search-btn *, .header-search-form, .header-search-form *')) {
$('.header-search-area').removeClass('active');
}
});
// 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
$("#preloader").delay(300).animate({
"opacity" : "0"
}, 300, function() {
$("#preloader").css("display","none");
});
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
///lazy loading image script
/* function lazyLoading(){
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)
}
lazyLoading(); */
// (function ($) {
// "user strict";
// Search options
$(".search-bar > a").on("click", function () {
$(".header-top-search-area").slideToggle();
});
// })($);