Skip to content

Commit 7a15bef

Browse files
authored
Merge pull request #1060 from codeRIT/bh-988
Random hero SVG on reload
2 parents cd14e95 + c7c75c5 commit 7a15bef

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

index.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import './sass/main.scss'
22
import '@fortawesome/fontawesome-free/css/all.css'
33

4-
// slick-carousel configuration
5-
import $ from 'jquery'
6-
import 'slick-carousel'
7-
84

5+
// Hiring message
96
const hiringMessage = `Hey, you.
107
You’re finally awake.
118
You were trying to see the code, right?
@@ -14,11 +11,32 @@ If you’d like to work on this website and other cool projects with hackathons,
1411

1512
console.log(hiringMessage);
1613

17-
// comment generated via js instead of directly in HTML so the hiring message text is only in one place
14+
// Comment generated via js instead of directly in HTML so the hiring message text is only in one place
1815
const comment = document.createComment("\n"+hiringMessage.toString()+"\n");
1916
document.insertBefore(comment, document.firstChild);
2017

2118

19+
// Random hero SVG on each page load
20+
import desk1 from './assets/desk1.svg'
21+
import desk2 from './assets/desk2.svg'
22+
import desk3 from './assets/desk3.svg'
23+
24+
$(document).ready(function() {
25+
var deskIndex = parseInt(localStorage.getItem('deskIndex'));
26+
if (!deskIndex) {
27+
deskIndex = 0;
28+
localStorage.setItem('deskIndex', 0);
29+
}
30+
var desks = [desk1, desk2, desk3]
31+
$('#desk').css('background-image', 'url(' + desks[deskIndex % desks.length] + ')');
32+
localStorage.setItem('deskIndex', deskIndex + 1);
33+
});
34+
35+
36+
// Slick-carousel
37+
import $ from 'jquery'
38+
import 'slick-carousel'
39+
2240
$(document).ready(function() {
2341
$('.carousel').slick({
2442
infinite: true,
@@ -67,6 +85,7 @@ $(document).on('keydown', function(event) {
6785
});
6886

6987

88+
// FAQ Cards hide/show
7089
let card = document.getElementsByClassName("card");
7190
for (let i = 0; i < card.length; i++) {
7291
let accordion = card[i].getElementsByClassName("accordion-header")[0];
@@ -90,6 +109,7 @@ for (let i = 0; i < card.length; i++) {
90109
});
91110
}
92111

112+
93113
// Schedule toggle code
94114
$('.day-second-events').hide();
95115
$('.day-first').click(function() {

sass/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ $event-count: 6;
7878
// Transition all elements on the screen
7979
// (except FAQ panel, which already has a transition,
8080
// and the section days, which need no transition.)
81-
&:not(.panel):not(#days):not(.number) {
81+
&:not(.panel):not(#days):not(.number):not(#desk) {
8282
transition: all 1s ease;
8383
}
8484

0 commit comments

Comments
 (0)