Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, November 8, 2012

Codecademy: Sample solution to "Move, element, get out the way"



//Sample solution to script.js
$('document').ready(function() {
$('#changeButton').click(function() {

//note:
//the div containing both 'lineJumper'
//and 'lineLeaver' has the id 'line'
var $divIDline = $('#line');
var $divIDlineJumper = $('#lineJumper');
var $divIDlineLeaver = $('#lineLeaver');

//move the div with id 'lineJumper'
//to be the first child of 'line'
$divIDlineJumper.prependTo($divIDline);

//move the div with id 'lineLeaver'
//out of the line (make it a sibling of the line)
$divIDlineLeaver.insertAfter($divIDline);

});
});

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts