Trước hết thì cần đánh dấu avatar cũng như tạo khung giữ avatar và liên kết thay avatar chung 1 chỗ.
Trong temp
viewtopic_body, tìm:
- Code:
{postrow.displayed.POSTER_AVATAR}
Thay bằng:
- Code:
<div class="poster-avatar">
{postrow.displayed.POSTER_AVATAR}
</div>
Thêm javascript dưới đây vào cuối temp
viewtopic_body:
- Code:
<script type="text/javascript">
//<![CDATA[
$(".poster-avatar").append(function () {
if ($(this).children("a").attr("href").match(/\d+/) == _userdata.user_id) return '<a class="change_avatar" href="/profile?mode=editprofile&page_profil=avatars">Thay ảnh đại diện</a>'
});
//]]>
</script>
Script trên sẽ tìm ra avatar nào là của mình (thành viên đang truy cập) và thêm liên kết thay ảnh đại diện vào bên dưới avatar.
Cuối cùng, chỉ cần thêm
CSS cho đẹp, ví dụ:
- Code:
.poster-avatar { /* Khung avatar */
position: relative;
overflow: hidden;
width: 130px;
}
.poster-avatar > a:first-child > img { /* Avatar */
width: 100%;
}
.poster-avatar > a.change_avatar { /* Liên kết thay avatar */
position:absolute;
left:0;
right:0;
bottom:-28px;
text-align:center;
background:#FFF;
height:28px;
line-height:28px;
color:#FFF;
transition:all .5s;
-webkit-transition:all .5s
}
.poster-avatar:hover > a.change_avatar { /* Liên kết thay avatar khi rê chuột */
bottom:0;
background:rgba(0, 0, 0, 0.75)
}
Zzbaivong