Skip to content

Instantly share code, notes, and snippets.

@taea
Created November 29, 2012 12:41
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 taea/4168815 to your computer and use it in GitHub Desktop.
Save taea/4168815 to your computer and use it in GitHub Desktop.
listの途中まで隠しておくjQuery(ださい)
:javascript
$(function(){
var contents = '.list li.hide';
var trigger = '.trigger';
$(contents).hide();
$(trigger).click(function(){
if($(contents + ':first').is(":hidden")){
$(contents).fadeIn("fast");
$(trigger).html([
'<a href="#">',
'<i class="icon-sort-up"></i>',
'閉じる',
'</a>'
].join(''));
}else{
$(contents).fadeOut("fast");
$(trigger).html([
'<a href="#">',
'<i class="icon-sort-down"></i>',
'もっと見る',
'</a>'
].join(''));
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment