This repository has been archived on 2025-06-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
perl-dam/www/dam/js/javascript.js
2020-04-10 12:48:19 +02:00

50 lines
1.5 KiB
JavaScript

// Fix for required fields in IE < 11:
/*
if ($("<input />").prop("required") === undefined) {
$(document).on("submit", function(e) {
$(this)
.find("input, select, textarea")
.filter("[required]")
.filter(function() { return this.value == ''; })
.each(function() {
e.preventDefault();
$(this).css({ "border-color":"red" });
alert( $(this).prev('label').html() + " is required!");
});
});
}
*/
$(function(){
$('#naviga a.option').click(function(){
$('#naviga > input[name=rm]').val(this.id);
$('#naviga').submit();
return false;
});
// Activate tooltips:
$('[data-toggle="tooltip"]').tooltip({container: 'body', delay: {show: 10, hide: 0}});
// Smooth scroll to anchor:
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({ scrollTop: target.offset().top - 90 }, 1000);
return false;
}
}
});
// Smooth scroll to top:
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
}
else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function(){
$('html, body').animate({ scrollTop: 0 }, 600);
return false;
});
});