Implemented interactive tutorial!

This commit is contained in:
Daniel Xie
2017-05-06 01:24:01 -05:00
parent e2cbc38920
commit 2e55f1d472
10 changed files with 558 additions and 187 deletions
+3 -3
View File
@@ -13,11 +13,11 @@ function sizeOfObject(obj) {
//e.g. addOffset(100, 5) will return anything from 95 to 105.
//The percentage argument must be between 0 and 100;
function addOffset(n, percentage) {
if (percentage < 0 || percentage > 100) {return ;}
if (percentage < 0 || percentage > 100) {return;}
var offset = n * (percentage / 100);
return n * (Math.random() * (2 * offset) - offset);
return n + ((Math.random() * (2 * offset)) - offset);
}
//Given an element by its Id(usually an 'a' element), removes all event listeners
@@ -27,5 +27,5 @@ function clearEventListeners(elemId) {
if (elem == null) {console.log("ERR: Could not find element for: " + elemId); return null;}
var newElem = elem.cloneNode(true);
elem.parentNode.replaceChild(newElem, elem);
return elem;
return newElem;
}