Home > php教程 > PHP开发 > Simple implementation of jquery heart-shaped like and follow effects

Simple implementation of jquery heart-shaped like and follow effects

高洛峰
Release: 2016-12-07 09:28:10
Original
2054 people have browsed it

html code

<div class="stage">
 <div class="heart"></div>
</div>
Copy after login

css code

.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%);
}
Copy after login

js code

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


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template