-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
31 lines (28 loc) · 1.09 KB
/
main.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
var press = $('button')
press.on("click", submit)
function submit(){
event.preventDefault();
var people = [
"Arthur Smith",
"Nathaniel Banks",
"Bernard Bass",
"Barbara Archibald",
"Betty Pillsbury",
"Agnes Cherryhill"
]
var randomDecimal = Math.random()*people.length
var randomNumber = Math.floor(randomDecimal)
var randomPerson = people[randomNumber]
var header = $('h2')
header.text(randomPerson)
var pic = [
"https://files.slack.com/files-pri/TK5GC0Y6T-FKSPSUYHK/q2.jpg",
"https://files.slack.com/files-pri/TK5GC0Y6T-FKSPSUYHK/q2.jpg",
"https://files.slack.com/files-pri/TK5GC0Y6T-FKSPSUYHK/q2.jpg",
"https://images.pexels.com/photos/432722/pexels-photo-432722.jpeg?auto=format%2Ccompress&cs=tinysrgb&dpr=2&h=750&w=1260",
"https://images.pexels.com/photos/432722/pexels-photo-432722.jpeg?auto=format%2Ccompress&cs=tinysrgb&dpr=2&h=750&w=1260",
"https://images.pexels.com/photos/432722/pexels-photo-432722.jpeg?auto=format%2Ccompress&cs=tinysrgb&dpr=2&h=750&w=1260"
]
var source = $('.pro')
$('.pro').attr("src", pic[randomNumber]);
}