jQuery实现点赞动态效果
实现动态效果基本上都是用到定时器,修改标签的位置大小颜色属性
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.zan{
line-height: 20px;
width: 20px;
height: 20px;
position: relative;
}
</style>
</head>
<body>
<div style="width: 500px;height: 300px;padding-left: 100px;padding-top: 150px">
<div class="zan">
<span>赞</span>
</div>
<hr><br>
<div class="zan">
<span>赞</span>
</div>
<hr><br>
<div class="zan">
<span>赞</span>
</div>
<hr><br>
</div>
<script src="jquery-3.3.1.js"></script>
<script>
$('.zan').click(function () {
var top = 0;
var left = 0;
var fontSize = 12;
var opacity = 1;
var tag = document.createElement('span');
$(tag).text('+1');
$(tag).css('position','absolute');
$(tag).css('float','left');
$(tag).css('color','blue');
$(tag).css('top',top + "px");
$(tag).css('left',left + "px");
$(tag).css('font-size',fontSize + "px");
$(tag).css('opacity',opacity);
$(this).append(tag);
var obj = setInterval(function () {
top = top - 5;
left = left + 5;
fontSize = fontSize + 5;
opacity = opacity - 0.2;
$(tag).css('top',top + "px");
$(tag).css('left',left + "px");
$(tag).css('font-size',fontSize + "px");
$(tag).css('opacity',opacity);
if(opacity < 0){
clearInterval(obj);
tag.remove();
}
},100);
});
</script>
</body>
</html>
jQuery实现点赞动态效果的更多相关文章
- JS框架_(JQuery.js)点赞按钮动画
百度云盘 传送门 密码: 0ihy 点赞按钮动画效果: (点击一次随机生成一颗小爱心,作为点赞动画~) <!doctype html> <html lang="en&quo ...
- jQuery显示隐藏动态效果的几种写法
<script type="text/javascript"> $(document).ready(function() { /*$("#test1& ...
- jquery+css 点赞喜欢特效
百度盘链接 https://pan.baidu.com/s/1Nu8fiUrdffsNd6usTsUESg 密码 mps4 效果:
- jQuery动态效果实例
jQuery常见的动态效果: 隐藏/显示效果: 1.(1):隐藏,显示:通过 jQuery,使用 hide() 和 show() 方法可以用来隐藏和显示 HTML 元素. (2):隐藏/显示的速度: ...
- Python开发【前端】:jQuery
jQuery简介 jQuery是一个快速.简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架).jQuery设计的宗旨是&qu ...
- Python学习笔记整理总结【web基础】【web/HTML/CSS/JavaScript/DOM/jQuery】
一.HTML HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记).相当于定义统一的一套规则,大家都来遵守他,这样就可以 ...
- jQuery常见案例
jQuery常见案例 通过jQuery实现全选,反选取消: 选择 地址 端口 1.1.1.1 80 1.1.1.1 80 1.1.1.1 80 1.1.1.1 80 代码实现 <body> ...
- Web前端基础——jQuery(三)
本文主要从以下几方面介绍jQuery应用中的内容: 1 jQuery 节点遍历2 jQuery 中的过滤器3 jQuery 属性操作4 jQuery Dom节点操作5 几个jQuery例子6 jQue ...
- jQuery前端第三方框架
计时器 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...
随机推荐
- python3:利用SMTP协议发送QQ邮件+附件
转载请表明出处:https://www.cnblogs.com/shapeL/p/9115887.html 1.发送QQ邮件,首先必须知道QQ邮箱的SMTP服务器 http://service.mai ...
- swift3.0 自定义键盘
...绕了一大圈,又绕回原生来了,今天,学习一下swift3.0语法下的自定义键盘.效果图如下: 其实,很简单,只需要把UITextView(或者UITextField)的inputView属性设置为 ...
- SAP Module Pool Program Learning Documentation——Commit Work and Update dtab
When using Native SQL to directly manipulate database tables, it makes a difference to use COMMIT WO ...
- Gauss error function
0. error function erf(x)=1π∫−xxe−t2dt" role="presentation">erf(x)=1π−−√∫x−xe−t2dte ...
- OSWATCH安装
.解压安装包 afadb2:/home/oracle$tar -xvf oswbb732.tar (注:先将安装包权限修改为oracle:oinstall,或者对应权限,以ORACLE用户进行解压) ...
- Python中的分支结构和循环结构
一.分支结构 语法: if 条件 : .... else : .... 例子: num = int(input("输入一个整数:")) if num<=10 ...
- [LeetCode&Python] Problem 401. Binary Watch
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom ...
- [LeetCode&Python] Problem 167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that the ...
- P1220 关路灯 (区间dp)
题目链接:传送门 题目大意: 总共有N盏灯,老张从点C(1 ≤ C ≤ N)开始关灯(关灯不需要等待时间,C点的灯直接关掉),与此同时灯开始烧电(已知功率Pi). 老张每次可以往左走关最近的灯或者往右 ...
- Formal Grammars of English -10 chapter(Speech and Language Processing)
determiner 限定词 DET propernoun 专有名词 NP (or noun phrase) mass noun 不可数名词 Det Nouns 限定词名词 relative pro ...