html代码

<div class="stage"> 
 <div class="heart"></div> 
</div>

css代码

.heart { 
 width: 100px; 
 height: 100px; 
 background: url("") no-repeat; 
 background-position: 0 0; 
 cursor: pointer; 
 -webkit-transition: background-position 1s steps(28); 
 transition: background-position 1s steps(28); 
 -webkit-transition-duration: 0s; 
     transition-duration: 0s; 
} 
.heart.is-active { 
 -webkit-transition-duration: 1s; 
     transition-duration: 1s; 
 background-position: -2800px 0; 
} 
 
body { 
 background: -webkit-linear-gradient(315deg, #121721 0%, #000000 100%) fixed; 
 background: linear-gradient(135deg, #121721 0%, #000000 100%) fixed; 
 color: #FFF; 
 font: 300 16px/1.5 "Open Sans", sans-serif; 
} 
 
.stage { 
 position: fixed; 
 top: 50%; 
 left: 50%; 
 -webkit-transform: translate(-50%, -50%); 
     transform: translate(-50%, -50%); 
} 

js代码

$(function() { 
 $(".heart").on("click", function() { 
  $(this).toggleClass("is-active"); 
 }); 
}); 

以上就是小编为大家带来的jquery心形点赞关注效果的简单实现全部内容了,希望大家多多支持~

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com