gpt4 book ai didi

jQuery:Gmail 之星?

转载 作者:行者123 更新时间:2023-12-03 22:44:04 26 4
gpt4 key购买 nike

我想知道是否有人有关于创建 Gmail 收件箱明星(最喜欢的)的任何好的教程?

编辑:

我想我想创建一些类似于 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(使用图像 Sprite 作为星星):

.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
});
});
});
});

按照您的意愿在您的后端进行处理。大概返回有多少个收藏夹来更新页面。简单。

关于jQuery:Gmail 之星?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2563094/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com