Skip to content

Instantly share code, notes, and snippets.

@meara
Forked from dbc-challenges/jquery_quiz.js
Last active December 27, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meara/7304812 to your computer and use it in GitHub Desktop.
Save meara/7304812 to your computer and use it in GitHub Desktop.
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the Socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
/*1. Use basic selectors (id, class, element) to choose an element on the page.
Use the .css() method to alter at least two CSS properties of this element. */
/*2. Use basic selectors and the find() method to select an image on the page
and change it with another image of your choice. */
/*3. Use traverse methods to select all instances of a repeated element on the page
(like the h3 surrounding the words 'Code Review' ) and use the animate() method to modify it.
*/
/*4. Try to find an element that requires at least three selectors / traverse
methods to locate it and then use the .on() method to bind an event handler
on these elements (use an event other than click).*/
/*5. Your choice. */
$( "#toc_2" ).click(function() { $(this).html("HOLY COW"); });
[
<h2 id=​"toc_2">​Objectives​</h2>​
]
$( "#toc_2" ).on( "mouseover", function() {
$( ".content" ).css( "background-image", "url('http://img.photobucket.com/albums/v629/Master_Becca/unicorn.png')" );
});
$( "#toc_2" ).on( "mouseover", function() {
$( this ).css( "color", "red" );
});
$('.infobox').on('mouseover', function(){ $('img').attr("src", "http://bit.ly/1b71IlI"); });
// To fix http://en.wikipedia.org/wiki/Centaur
$('.infobox').on('mouseover', function(){ $('img').attr("src", "http://bit.ly/1b71IlI"); });
$( "#mw-content-text" ).click(function() { $("#mw-content-text").children("h2").html( "Habits of the Ollitaur" ); });
$( "#mw-content-text" ).click(function() { $("#firstHeading").html( "Ollitaurrrrrr" ); });
$('#toc_1').animate({
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em",
borderWidth: "10px"
}, 1500 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment