Created
November 25, 2015 14:24
-
-
Save nonZero/3fb54e03808ecc297c45 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<div id="add">Add!!</div> | |
<ul id="foo"> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
<li>0</li> | |
</ul> | |
<hr/> | |
<ul id="bar"> | |
<li>1</li> | |
<li>1</li> | |
</ul> | |
<script src="jquery-2.1.4.js"></script> | |
<script src="scripts.js"></script> |
This file contains hidden or 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
"use strict"; | |
console.log("start scripts"); | |
$(function() { | |
console.log("dom ready"); | |
$("#add").click(function() { | |
$("<li>klom</li>").appendTo($("#foo")); | |
}); | |
$("#foo").on('click', 'li', function() { | |
var el = $(this); | |
el.fadeOut(1000, function() { | |
el.appendTo($("#bar")).fadeIn(); | |
}); | |
}); | |
$("#bar").on('click', 'li', function() { | |
var el = $(this); | |
el.fadeOut(1000, function() { | |
el.appendTo($("#foo")).fadeIn(); | |
}); | |
}); | |
}); | |
console.log("end scripts"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment