-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
61 lines (52 loc) · 2.02 KB
/
script.js
File metadata and controls
61 lines (52 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
window.onload = function() {
var path = location.pathname;
var page = path.split("/").pop();
if (page == 'aluno.html' || page == 'professor.html'){
document.body.style.background = 'linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, .9)), url(imagem/harvard_alunos.jpg) no-repeat';
document.body.style.backgroundPosition = 'center';
document.body.style.backgroundSize = 'cover';
document.body.style.backgroundAttachment = 'fixed';
} else if (page == 'pais.html' || page == 'secretaria.html'){
document.body.style.background = 'linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, .9)), url(imagem/harvard_serious.jpg) no-repeat';
document.body.style.backgroundPosition = 'center';
document.body.style.backgroundSize = 'cover';
document.body.style.backgroundAttachment = 'fixed';
}
}
//Botão para voltar à parte superior da página
$(document).ready(function(){
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 500) {
$('.scrollToTop').fadeIn(600);
} else {
$('.scrollToTop').fadeOut(600);
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
});
//Scroll da página clicando nos links(História/Contato)
$(document).ready(function(){
// Add smooth scrolling to all links
$("a").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 1400, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
});