Mobile Comment Point Save function
Today we continue to share a comment on the function of saving, feel this functional logic is very interesting, organized down, the need for partners can learn together.
650) this.width=650; "class=" AlignCenter size-full wp-image-1411 "src=" http://www.aliyue.net/wp-content/uploads/ 2017/06/clike.gif "alt=" Clike "width=" 610 "height=" 537 "style=" height:auto;vertical-align:middle;border:0px; text-align:center;margin:0px auto; "/>
The function effect is like this, let's break down the code.
HTML section
<ul id= "Comments_list" > <li class= "comments" > <div class= "Com_top" > <span class= "Photo" > </span> <span class = "Name" > Wind-up </span> </div> <div class= "com_ Content "> If we have a tacit understanding, that time long and what relationship. I like words that have feelings. Write the reality and warmth. Take your headphones and close your eyes and listen to this "let's be late together." And then for life. " </div> <div class=" > "Com_bottom" <span class= "Time" >2017-04-18</span> <span class= "Useful" > <span class= "Like_num" >1</span> useful </span> </div> </li> </ul>
CSS Section
. com_bottom. useful{float:right; font-size:10px; Padding:0 15px; Text-align:center; line-height:20px; border-radius:10px; Color: #999999; border:1px solid #999999;}. Com_bottom. Useful.usefulclick {color: #F32D27; border:1px solid #F32D27;}
JS section
Likes $ ("#comments_list li.comments. Useful"). Click (function () {var $likeNum = $ (this). Find ('. Like_num '); var num = + $likeNum. Text () if (!$ (this). Hasclass (' Usefulclick ')} {$ (this). addclass (' Usefulclick '); $likeNum. Text (++num); }else{Console.log ("tag has Usefulclick"); } });
SOURCE download
This article is from the "Xiao Yue Blog" blog, please be sure to keep this source http://aliyue.blog.51cto.com/11564403/1942418
Mobile Comment Point Save function