This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log(myContainer); | |
// Hey everybody! Come see how good I look! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var log = function(someVariable) { | |
console.log(someVariable); | |
return someVariable; | |
} | |
log(myContainer); | |
// Hey everybody! Come see how good I look! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var classyMessage = function() { | |
return "Stay classy San Diego!"; | |
} | |
log(classyMessage); | |
// [Function] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doSomething = function(thing) { | |
thing(); | |
} | |
var sayBigDeal = function() { | |
var message = "I’m kind of a big deal"; | |
log(message); | |
} | |
doSomething(sayBigDeal); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var el1 = document.getElementById('main-carousel'); | |
var slider1 = new Carousel(el1, 3000); | |
slider1.init(); | |
var el2 = document.getElementById('news-carousel'); | |
var slider2 = new Carousel(el2, 5000); | |
slider2.init(); | |
var el3 = document.getElementById('events-carousel'); | |
var slider3 = new Carousel(el3, 7000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initialiseCarousel(id, frequency) { | |
var el = document.getElementById(id); | |
var slider = new Carousel(el, frequency); | |
slider.init(); | |
return slider; | |
} | |
initialiseCarousel('main-carousel', 3000); | |
initialiseCarousel('news-carousel', 5000); | |
initialiseCarousel('events-carousel', 7000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var unicornEl = document.getElementById('unicorn'); | |
unicornEl.className += ' magic'; | |
spin(unicornEl); | |
var fairyEl = document.getElementById('fairy'); | |
fairyEl.className += ' magic'; | |
sparkle(fairyEl); | |
var kittenEl = document.getElementById('kitten'); | |
kittenEl.className += ' magic'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addMagicClass(id) { | |
var element = document.getElementById(id); | |
element.className += ' magic'; | |
return element; | |
} | |
var unicornEl = addMagicClass('unicorn'); | |
spin(unicornEl); | |
var fairyEl = addMagicClass('fairy'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addMagic(id, effect) { | |
var element = document.getElementById(id); | |
element.className += ' magic'; | |
effect(element); | |
} | |
addMagic('unicorn', spin); | |
addMagic('fairy', sparkle); | |
addMagic('kitten', rainbow); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addColour(colour) { | |
var rainbowEl = document.getElementById('rainbow'); | |
var div = document.createElement('div'); | |
div.style.paddingTop = '10px'; | |
div.style.backgroundColour = colour; | |
rainbowEl.appendChild(div); | |
} | |
addColour('red'); | |
addColour('orange'); |