【发布时间】:2011-09-15 20:41:22
【问题描述】:
我想知道如何使用 jquery 隐藏帖子。我能够使用 jquery api 中的此代码隐藏帖子
<head>
<style>
span { background:#def3ca; padding:3px; float:left; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button id="hidr">Hide</button>
<button id="showr">Show</button>
<div>
<span>Once</span> <span>upon</span> <span>a</span>
<span>time</span> <span>there</span> <span>were</span>
<span>three</span> <span>programmers...</span>
</div>
<script>
$("#hidr").click(function () {
$("span:last-child").hide("fast", function () {
// use callee so don't have to name the function
$(this).prev().hide("fast", arguments.callee);
});
});
$("#showr").click(function () {
$("span").show(2000);
});
</script>
</body>
但问题是这不会保存隐藏,所以当我刷新浏览器时,帖子会再次显示。我希望能够让发布帖子的用户隐藏并为他隐藏帖子,但也为网站上的其他人隐藏。我不确定如何完成这项工作,所以我可以使用一些帮助。
【问题讨论】:
标签: jquery ruby-on-rails ruby-on-rails-3 hide