我想知道是否有人有关于创建 Gmail 收件箱明星(最喜欢的)的任何好的教程?
EDIT:
我想我想创建一些类似于 stackoverflow star 或 gmail inbox star 的东西。我有一组列表项,我在其中添加了多个控件。一个是复选框(用于存档或批量删除),另一个是用于收藏的占位符复选框。我只是好奇用 jquery 使它变得时髦的最佳方法是什么。
HTML:
<div id="[item id, probably a number]">
<p><a href="javascript:" class="star">Favorite Me!</a></p>
</div>
CSS(使用图像精灵作为星星):
.star {
text-indent: -5000px;
display: block;
background: transparent url(../images/star.png) [coords for empty star];
height: [height of star];
width: [width of star];
}
.star.favorited {
background-position: [coordinates for favorited star];
}
jQuery:
$(function() {
$('star').click(function() {
var id = $(this).parents('div').attr('id');
$(this).toggleClass('favorited');
$.post('/yourUpdateUrl',
{'favorited': $(this).hasClass('favorited'), 'id': id},
function(data) {
//some sort of update function here
});
});
});
});
在您的后端上按照您的意愿进行处理。大概返回有多少个收藏夹来更新页面。简单的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)