yichao firstname, zeaster nickname, zhang lastname

js feature by jQuery copied from codeplayer

Now, after loading this page, all titles of the posts are folded and click "+" to unfold, click title to dig into the single post page.
The feature above is implemented by the following code copied from codeplayer.
css part:
.mytoggle{
  cursor:pointer;
  font-size:22px;
  color:green;
}

script part:
<script src='http://www.douban.com/js/jquery.js' type='text/javascript'></script>
<script language='javascript'>
$(function(){
  $(".post-title").prepend("<span class='mytoggle'>-</span>");
  $(".mytoggle").click(
    function(e){
      var content = $(this).parent().next().next();
      content.toggle();
      if(content.css("display")=="none")
        $(this).html("+");
      else
        $(this).html("-");
    }
  ).click();
})
</script>

No comments: