This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall_java.js
108 lines (70 loc) · 2.64 KB
/
all_java.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Credits to Materials Theory Group (https://www.materials-theory.group/home) for design inspiration
// Contributors: Caden Allen
//Useful Docs:
//https://developer.mozilla.org/en-US/
//https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Writing_style_guide/Code_style_guide/JavaScript
//https://swimm.io/learn/code-documentation/code-documentation-javascript-methods-and-best-practices
//Organized by the following categories (use CLTR + F and search category names)
// HOVER DROPDOWN ICONS FUNCTIONALITY
// MEDIA QUERIES | RESPONSIVE DESIGN
// ROTATING GALLERY
// HOVER DROPDOWN ICONS FUNCTIONALITY
/**
* Makes Navigation-bar hover boxes have opacity of 1 (to be visible)
*
* @param {string} element - The element (item that is hovered over) to make visible
*
* @returns {void}
*/
function makeVisible(element){
console.log(element);
document.getElementById(element).setAttribute("style", "opacity: 1");
}
// :/ End of commenting for above section
// MEDIA QUERIES | RESPONSIVE DESIGN
// :) This section of commenting ends at the next ":)"
// This section checks for media size, IF the media matches
// 780px then the media is a mobile device and the website needs to hide
// certain items and change layout
//holds max-width for media
var viewportSize = window.matchMedia("(max-width: 780px)");
function checkForMobileDevice(viewportSize) {
//If media query matches, hide navigation bar items...,
//only show tab menu on navigation bar and logo
if(viewportSize.matches) {
}
}
checkForMobileDevice(viewportSize);
viewportSize.addEventListener("change", function() {
checkForMobileDevice(viewportSize);
})
// :) End of commenting for above section
/* ROTATING GALLERY */
const IMAGES_LOCATION = "./assets/pictures/gallery-pictures/img-";
const NUMBER_OF_IMAGES = 2;
/**
* Makes an image gallery that changes images every 5 seconds
*
* @requires IMAGES_LOCATION - location of images to cycle through
* @requires NUMBER_OF_IMAGES - number of images stored in IMAGES_LOCATION
*
* @returns {void}
*/
async function rotateImages() {
//
var i = 1;
while(i <= NUMBER_OF_IMAGES){
//Sets the new temporary image
var newImage = IMAGES_LOCATION + i + ".png";
//This MUST have ID set here manually to work
document.getElementById("rotating-image").src = newImage;
//This forces a wait of 5 seconds between changing pictures
await new Promise(r => setTimeout(r, 5000));
//Resets the image gallery back to the first image
if(i + 1 > NUMBER_OF_IMAGES){
i = 1;
} else {
i++;
}
}
}