微信小图消息数如何统计?
- 内容介绍
- 文章标签
- 相关推荐
本文共计79个文字,预计阅读时间需要1分钟。
使用HTML和CSS构建网页的基础知识
htmlcss
#wechat { display:inline-block; position:relative; } #pic { width:200px; height:200px; } #mesgNum { width:30px; height:30px; line-height:30px; font:16px; font-weight:bold; color:#fff; text-align:center; border-radius:50%; background-color:#f00; position:absolute; right:0px; top:-10px; } js
$(function() { $("#pic").click(function() { var strnum = $("#mesgNum").text(); if (strnum == "") { $("#mesgNum").text('1'); } else { var num = parseInt(strnum) num = num + 1; $("#mesgNum").text(num); } }); });
本文共计79个文字,预计阅读时间需要1分钟。
使用HTML和CSS构建网页的基础知识
htmlcss
#wechat { display:inline-block; position:relative; } #pic { width:200px; height:200px; } #mesgNum { width:30px; height:30px; line-height:30px; font:16px; font-weight:bold; color:#fff; text-align:center; border-radius:50%; background-color:#f00; position:absolute; right:0px; top:-10px; } js
$(function() { $("#pic").click(function() { var strnum = $("#mesgNum").text(); if (strnum == "") { $("#mesgNum").text('1'); } else { var num = parseInt(strnum) num = num + 1; $("#mesgNum").text(num); } }); });

