pages/js/MillironX_CustomScripts.js

59 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-09-18 17:45:13 +00:00
/*!
* Custom scripts for millironx.github.io
*/
// Resize the window image on first page load
$(".img-src").width($("#main-content").width());
2019-09-28 19:09:39 +00:00
if ($("#top-container").width() > 768) {
$("#nav-link-container").height($("#nav-link-list").height());
}
2020-09-18 17:45:13 +00:00
// Resize the window image if the screen size changes
2019-09-28 19:09:39 +00:00
$(window).resize(function () {
$(".img-src").width($("#main-content").width());
if ($("#top-container").width() > 768) {
$("#nav-link-container").height($("#nav-link-list").height());
}
else {
$("#nav-link-container").css('height', '');
}
});
2020-09-18 17:45:13 +00:00
// Squeeze the heading text into the proper box
2019-09-28 18:00:44 +00:00
$("#motto").fitText();
2020-09-18 17:45:13 +00:00
$("[rel='tooltip']").tooltip();
// Animate the transparency for the glossy scroll effect
var transparentDemo = true;
var fixedTop = false;
$(window).scroll(function(e) {
oVal = ($(window).scrollTop() / 170);
$(".blur").css("opacity", oVal);
2021-03-17 20:32:36 +00:00
if (oVal >= 3) {
$(".img-src").css("visibility", "hidden")
}
else {
$(".img-src").css("visibility", "")
}
2020-09-18 17:45:13 +00:00
});
// Add class to invalid elements
var invalidClassName = 'invalid'
var inputs = document.querySelectorAll('input, select, textarea')
inputs.forEach(function (input) {
// Add a css class on submit when the input is invalid.
input.addEventListener('invalid', function () {
input.classList.add(invalidClassName)
})
// Remove the class when the input becomes valid.
// 'input' will fire each time the user types
input.addEventListener('input', function () {
if (input.validity.valid) {
input.classList.remove(invalidClassName)
}
})
})