custom-javascript.js 3.08 KB
import jQuery from 'jquery';
import jQueryBridget from 'jquery-bridget';
import Isotope from "isotope-layout";
import DataTable from 'datatables.net-bs5';
import validate from 'jquery-validation';


jQueryBridget( 'isotope', Isotope, $ );

// Add your custom JS here.
import "./_carousels";
import "./jssocials.min";
import "./_course_list";
import "./_resources_list";



var a = document.querySelector('.blur-image');

document.addEventListener("DOMContentLoaded", function() {
    if (!a) return !1;
    var b = a.getAttribute("data-src"),
        c = document.querySelector('.full-image'),
        img = new Image;

    img.src = b;

    img.onload = function() {

        c.classList.add('image-loaded'),
            c.style.backgroundImage = 'url(' + b + ')';
    };
});


        document.addEventListener("DOMContentLoaded", function() {
            window.addEventListener('scroll', function() {
                if (window.scrollY > 57) {
                    document.getElementById('main-nav').classList.add('fixed-top');
            
                } else {
                    document.getElementById('main-nav').classList.remove('fixed-top');
                    document.getElementById('search').classList.remove('open');
                    document.getElementById('search-button').classList.remove('open');
                }
            });
        });

//Get the button
let mybutton = document.getElementById("btn-back-to-top");

// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {
    scrollFunction();
};

function scrollFunction() {
    if (
        document.body.scrollTop > 20 ||
        document.documentElement.scrollTop > 20
    ) {
        mybutton.style.display = "block";
    } else {
        mybutton.style.display = "none";
    }
}
// When the user clicks on the button, scroll to the top of the document
mybutton.addEventListener("click", backToTop);

function backToTop() {
    document.body.scrollTop = 0;
    document.documentElement.scrollTop = 0;
}



jQuery(document).ready(function($) {
var $search = $('.search').clone();
$search.addClass('mobile');
$('.search').attr('id','search');
$('.search-button').attr('id','search-button');
$('#navbarNavDropdown').prepend($search);


    $(document).on("click", ".search-button a, .close", function(e) {
            e.preventDefault();
            $('.search-button').toggleClass('open');
            $('.search').toggleClass('open');
        
    });

    $('.register').attr('id','register');

      $("#register").validate({
        // Specify validation rules
        rules: {
            billing_first_name: {
                required: true, 
            },
            billing_last_name:{
                required: true, 
            },
            email: {
                required: true,
                email: true
            },
            password: {
                required: true,
                minlength: 10
            },
            password2: {
                required: true,
                minlength: 10,
                equalTo: "#reg_password"
            }
        },
     
      });

});