How to Create Twitter Heart Button Animation
Submitted by alpha_luna on Thursday, June 23, 2016 - 16:22.
In this article, we are going to create Twitter Heart Button Animation with CSS3. Twitter has released a new heart button, it's a replacement for the favorite button. This heart button it's a cool animation effect for click action. This article will help you how to create this using CSS3 and jQuery.

Creating Markup
Displaying example of a news feed. Copy and paste this HTML source code to your BODY tag of your page.JavaScript Codes
It contains the class name of the DIV tag. Copy and paste this script and link to your HEAD tag of your page.- <script src="js_code.js"></script>
- <script>
- $(document).ready(function()
- {
- $('body').on("click",'.heart_animation_Class',function()
- {
- var A=$(this).attr("id");
- var B=A.split("like");
- var messageID=B[1];
- var C=parseInt($("#count_For_Like"+messageID).html());
- $(this).css("background-position","")
- var D=$(this).attr("rel");
- if(D === 'like')
- {
- $("#count_For_Like"+messageID).html(C+1);
- $(this).addClass("heartAnimation").attr("rel","unlike");
- }
- else
- {
- $("#count_For_Like"+messageID).html(C-1);
- $(this).removeClass("heartAnimation").attr("rel","like");
- $(this).css("background-position","left");
- }
- });
- });
- </script>
Was this article helpful?
Kindly click the "Download Code" button below for full source code. Thank you very much. Hope that this tutorial will help you a lot. Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.Add new comment
- 424 views