This file contains 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
//this is based off of Brad Frost's jQuery toggle | |
document.querySelector('html').setAttribute('class', 'js'); //if you want to use Progressive Enhancement on the page, put class="no-js" into the html tag of the document. If you don't care you can skip this line. | |
var menulink = document.getElementById('menu-link'); | |
var menu = document.getElementById('menu'); | |
menulink.onclick = function(){ | |
menulink.classList.toggle('active'); | |
menu.classList.toggle('active'); | |
return false; |
This file contains 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
<meta charset="UTF-8"> | |
<meta name="description" content="Free Web tutorials"> | |
<meta name="keywords" content="HTML,CSS,XML,JavaScript"> | |
<meta name="author" content="Hege Refsnes"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Random Student Order</title> | |
</head> | |
<body> | |
<h1>Order of Presentations</h1> | |
<p>Determined by a randomly shuffled array:</p> | |
<div id="message"></div> |
This file contains 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 rectHit(rectone, recttwo){ | |
//console.log('recthit called'); | |
var r1 = $(rectone); | |
var r2 = $(recttwo); | |
var r1x = r1.offset().left; | |
var r1w = r1.width(); | |
var r1y = r1.offset().top; | |
var r1h = r1.height(); | |
This file contains 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 circleHit(circle1, circle2) { | |
//circle1 is first parameter, circle2 is second parameter | |
//in bullet vs. enemy circle1 is the current bullet, circle2 is the current enemy | |
var c1 = $(circle1); //assigns to new local variable | |
var c2 = $(circle2); | |
c1.r = c1.width() / 2; //r stands for radius | |
c1.x = c1.position().left + c1.r; | |
c1.y = c1.position().top + c1.r; |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Day 2 - Slide 31 Code Joke Example</title> | |
<style type="text/css"> | |
body{ | |
font-size: 20px; | |
font-family: Verdana; | |
} | |
</style> |
This file contains 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
<doctype! html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dynamic Scrolling to Section</title> | |
<style type="text/css"> | |
nav { | |
width: 100%; | |
margin: 0 auto; | |
text-align: center; |
This file contains 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 htmlElementIs(element){ | |
var element = element.toString(); | |
return element; | |
} | |
//usage | |
var myElement = document.body.children[0].children[0]; //gets my targeted element | |
console.log(htmlElementIs(myElement)); //returns ex: [object HTMLUListElement] | |
//more specific version: | |
function htmlElementIs(element){ |
This file contains 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
<html> | |
<head> | |
<title>My Page</title> | |
</head> | |
<body> | |
<header> | |
<nav> | |
<ul class="menu"> | |
<li><a href="#">Link One</a></li> | |
<li><a href="#">Link Two</a></li> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Selector Methods</title> | |
</head> | |
<body> | |
<div class="mtclass">Some text</div> | |
<div class="mtclass">Some more text</div> | |
<div class="mtclass">Some other text</div> |
NewerOlder