-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now you can click buttons and they do things.
- Loading branch information
Showing
3 changed files
with
73 additions
and
24 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//get all the option buttons | ||
var options = document.getElementsByClassName('option'); | ||
|
||
var dev1 = { | ||
name:"George", | ||
description:"George is probably the coolest iPhone to exist. Ever. Point blank, period.", | ||
hardware:"iphone", | ||
software:"apple" | ||
}; | ||
|
||
var dev2 = { | ||
name:"Greyson", | ||
description:"Greyson is pretty cool.. I guess.", | ||
hardware:"iphone", | ||
software:"apple" | ||
}; | ||
|
||
var dev3 = { | ||
name:"Linkin Park", | ||
description:'"The hardest part of ending is starting again."', | ||
hardware:"ipad", | ||
software:"apple" | ||
}; | ||
|
||
var dev4 = { | ||
name:"Abercrombie", | ||
description:"To all the people that hated me in high school, I have the prettiest clothes you all wear now!!", | ||
hardware:"ipad", | ||
software:"apple" | ||
}; | ||
|
||
var dev5 = { | ||
name:"Hulk", | ||
description:"Go ahead and HULK SMASH! this awesome computer stick into your USB.", | ||
hardware:"computerStick", | ||
software:"intel" | ||
}; | ||
|
||
var dev6 = { | ||
name:"Captain America", | ||
description:'"Make America Great Again. Wait, thats someone else.."', | ||
hardware:"computerStick", | ||
software:"intel" | ||
}; | ||
|
||
var devices = [dev1, dev2, dev3, dev4, dev5, dev6]; | ||
|
||
for(var a = 0; a < options.length; a++){ | ||
var type = options[a].getAttribute('data-type'); | ||
options[a].addEventListener('click', show); | ||
} | ||
|
||
function show(){ | ||
var type = this.getAttribute('data-type'); | ||
var html = ''; | ||
|
||
for(var i = 0; i < devices.length; i++){ | ||
if(type.localeCompare(devices[i].hardware) == 0 || type.localeCompare(devices[i].software) == 0){ | ||
html += '<div style="border: solid; border-width: thin; padding: 15px;"><div style = "display: inline-block; text-align: center;"><img src="imgs/' + devices[i].hardware + '.png" style="display: block;">' + devices[i].name + '</div><div style="display: inline-block; width: 200px; text-align: center; vertical-align: center;"><p>' + devices[i].description + '</p><button type="button" style="display: block; margin: auto;">Order device</button></div></div><br>' | ||
} | ||
} | ||
|
||
document.getElementById('devContainer').innerHTML = html; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.