PageSourceSearch

https://www.isb-solutions.de/wp-content/themes/picostrap5-child-base/js/custom.js

js isb-solutions.de collected 2026-10-09 17:31:45 UTC 3,375 bytes, 112 lines download raw bytes

1// Form Validation
2(() => {
3    'use strict'
4  
5    // Fetch all the forms we want to apply custom Bootstrap validation styles to
6    const forms = document.querySelectorAll('.needs-validation')
7  
8    // Loop over them and prevent submission
9    Array.from(forms).forEach(form => {
10      form.addEventListener('submit', event => {
11        if (!form.checkValidity()) {
12          event.preventDefault()
13          event.stopPropagation()
14        }
15  
16        form.classList.add('was-validated')
17      }, false)
18    })
19})()
20
21
22document.addEventListener("DOMContentLoaded", () => {
23  let form = document.getElementById("header-search-form");
24  let input = form.querySelector('.form-control');
25  let menuWidth = document.getElementById("menu-menu-1").offsetWidth;
26  let button = document.getElementById("header-search-trigger");
27
28  button.addEventListener("click", function() {
29    this.preventDefault;
30
31    if (form.classList.contains('d-lg-none')) {
32      form.classList.remove('d-lg-none');
33      form.classList.add('d-block');
34      this.classList.remove('bi-search');
35      this.classList.add('bi-x-lg');
36      form.style.width = menuWidth + 'px';
37      input.focus();
38    } else {
39      form.classList.remove('d-block');
40      form.classList.add('d-lg-none');
41      this.classList.remove('bi-x-lg');
42      this.classList.add('bi-search');
43    }
44  });
45});
46
47// Logo Carousel
48let items = document.querySelectorAll('.isb-carousel.carousel .carousel-item')
49items.forEach((el) => {
50    const minPerSlide = 6
51    let next = el.nextElementSibling
52    for (var i = 1; i < minPerSlide; i++) {
53        if (!next) {
54        	next = items[0]
55      	}
56        let cloneChild = next.cloneNode(true)
57        el.appendChild(cloneChild.children[0])
58        next = next.nextElementSibling
59    }
60})
61
62
63document.addEventListener("DOMContentLoaded", function() {
64
65  // Custom HR Newsletter Form
66  if (document.getElementById('ws-form-hr') != null) {
67    document.getElementById('ws-form-hr').addEventListener('submit', function(e) {
68      var invalidPrivacy = document.getElementById('wsf-1-invalid-feedback-59-row-1');
69      var invalidEmail = document.getElementById('wsf-1-invalid-feedback-55');
70      var checkboxPrivacy = document.getElementById('wsf-1-field-59-row-1');
71      var inputEmail = document.getElementById('wsf-1-field-55');
72  
73      invalidPrivacy.classList.remove('d-block');
74      invalidEmail.classList.remove('d-block');
75  
76      if (!checkboxPrivacy.checked) {
77          e.preventDefault();
78          invalidPrivacy.classList.add('d-block');
79      }
80  
81      if (!inputEmail.value) {
82          e.preventDefault();
83          invalidEmail.classList.add('d-block');
84      }
85    });  
86  }
87
88  // Check for Divi Page Builder
89  const divi = document.querySelector("#et-boc");
90  if (divi != undefined)
91    document.body.classList.add("is-divi");
92  
93});
94
95// Sticky Nav Scroll Position
96let scrollpos = window.scrollY
97const header = document.querySelector("#wrapper-navbar");
98let header_height = header.offsetHeight;
99
100const add_class_on_scroll = () => header.classList.add("is-small")
101const remove_class_on_scroll = () => header.classList.remove("is-small")
102
103window.addEventListener('scroll', function() { 
104  scrollpos = window.scrollY;
105  header_height = header.offsetHeight;
106
107  if (scrollpos > header_height) {
108    add_class_on_scroll();
109  } else {
110    remove_class_on_scroll();
111  }
112})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.