Skip to content

Instantly share code, notes, and snippets.

@ljkfgh2008
Created October 23, 2014 03:42
Show Gist options
  • Save ljkfgh2008/dc2a03a24537d2b4abea to your computer and use it in GitHub Desktop.
Save ljkfgh2008/dc2a03a24537d2b4abea to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
<script>
$(function(){
console.log($('.av-options a'));
$('.av-options a').on('click', function(){
if($(this).data('up')){
$(this).parent('.av-options').animate({
height : '100px'
});
$(this).removeClass('up');
$(this).addClass('down');
$(this).data('up', 0);
} else {
$(this).parent('.av-options').animate({
height : '500px'
});
$(this).removeClass('down');
$(this).addClass('up');
$(this).data('up', 1);
}
});
})
</script>
<style type="text/css">
.av-options{height:100px; background:red;}
.av-options a{ display:block; height:100px;}
</style>
</head>
<body>
<div class="av-options">
<a class="down">aaaaaaaaaa</a>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment