JQuery第三天
1.学习目标
PC端特效
移动端特效
后台特效
特效插件
2.知识讲解
1.插件库
Jquery插件库的使用
2.swiper轮播图插件
swiper.js: 可以实现网页中所有的滑动效果.(tab菜单,轮播图,单滚动)
官网:https://www.swiper.com.cn/
https://www.swiper.com.cn/demo/index.html 所有的演示页,可以抄代码
模拟滚动条,上拉刷新,下拉刷新
3.Bootstrap特效
Bootstrap依赖于Jquery
4.validform.js 表单验证
bootstrapvalidator:https://www.cnblogs.com/landeanfen/p/5035608.html
https://github.com/nghuuphuoc/bootstrapvalidator
第一步:引入文件
第二步: 根据文档去实现功能
第三步: 修改样式并调整功能
了解:validform.js:http://validform.club/document.html
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="./validate/css/bootstrapValidator.css">
<script src="./jquery/jquery-3.4.0.js"></script>
<script src="./bootstrap/js/bootstrap.js"></script>
<script src="./validate/js/bootstrapValidator.js"></script>
$(function() {
$('.box form').bootstrapValidator({
message: '数据不合法',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
message: '用户名验证失败',
validators: {
notEmpty: {
message: '用户名不能为空'
}
}
},
password: {
validators: {
notEmpty: {
message: '密码不能为空'
},
stringLength: {
min: 6,
max: 18,
message: '密码长度必须在6到18位之间'
},
}
}
}
});
})
5.Moment.js 时间格式化
使用说明:https://www.jianshu.com/p/5715f4bad95c
1.引入moment.js
2.设置配置文件为中文,不然是英文
3.直接使用moment方法
moment(new Date()).format('MM月DD日');
moment(new Date()).format('MMM');
moment(new Date()).format('MMMM');
moment(new Date()).format('dd');
moment(new Date()).format('ddd');
moment(new Date()).format('dddd');
moment(new Date()).isoWeekday();
moment(new Date()).isoWeekYear();
moment(new Date()).format('LT');
moment(new Date()).format('LTS');
moment(new Date()).format('L');
moment(new Date()).format('LL');
moment(new Date()).format('LLL');
moment(new Date()).format('LLLL');
moment(new Date()).format('l');
moment(new Date()).format('ll');
moment(new Date()).format('lll');
moment(new Date()).format('llll');
moment(new Date()).format('A');
moment(new Date()).format('a');
moment(new Date()).format('ALT')
moment().add(7, days).format('LL');
moment().subtract(7, 'days').format('LL');
moment().add(9, 'hours').format('HH:mm:ss');
moment().add(1, 'week').format('LL');
moment([2017, 0, 29]).fromNow(true);
moment([2017, 0, 29]).fromNow();
moment([2019, 0, 29]).fromNow(true);
moment([2019, 0, 29]).fromNow();
moment("20120901", "YYYYMMDD").fromNow();
moment(+new Date() - 1000 * 300).fromNow();
moment(+new Date() - 1000 * 3).fromNow();
moment(+new Date() - 3 * 24 * 60 * 60 * 1000).fromNow();
moment(+new Date() - 30 * 24 * 60 * 60 * 1000).fromNow();
moment(+new Date() - 365 * 24 * 60 * 60 * 1000).fromNow();
moment([2007, 0, 29]).toNow()
moment([2020, 0, 29]).toNow()
moment([2020, 0, 29]).toNow(true)
moment([2007, 0, 29]).to()
moment([2020, 0, 29]).to()
moment([2020, 0, 29]).to(true)
moment([2007, 0, 29]).diff(moment([2007, 0, 28]));
moment([2007, 0, 29]).diff(moment([2007, 0, 28]), 'days')
moment("2012-02", "YYYY-MM").daysInMonth()
6.scrollbar.js 模拟滚动条
1.引入jq
2.引入slimscrollbar
3.调用方法
$(function() {
$(".box div").slimScroll({
height: '200px'
});
})
注意: 滚动内容需要单独给一个div盒子,方便进行移动,不然父盒子会100%宽度
详细说明文档:https://www.cnblogs.com/beyrl-blog/p/6678804.html
7.Echart.js 数据图表展示
1.下载文件并引入
2.看说明文档使用 https://echarts.baidu.com/api.html#action
8.wangEditor富文本编辑器
了解ueditor
我们使用:wangEditor
说明文档:https://www.kancloud.cn/wangfupeng/wangeditor3/335775
https://github.com/wangfupeng1988/wangEditor/
下载地址:https://github.com/wangfupeng1988/wangEditor/releases
9.zepto.js
文档:https://www.html.cn/doc/zeptojs_api/#
注意:zepto的官网文档中下载只能下载zepto主要文件,其他的单独模块文件无法下载,所以得去github上下载
使用方法: 几乎跟jquery一致,增加了手势,触摸等常用事件
zepto将很多功能单独的剥离成单独的文件,需要就引用,避免整个文件过大.
移动端的tap点击事件
触摸事件的使用: https://www.cnblogs.com/0liaoyi/p/6110505.html
10.faskclick.js
在pc端,点击事件有默认的300毫秒的延迟,所以在手机端就会影响点击性能,所以要弥补这个问题.
https://www.jianshu.com/p/67bae6dfca90
引入fastclick文件
$(function() {
FastClick.attach(document.body);
});
11.loding
css3loading动画: http://www.jq22.com/jquery-info4405
配合jquery一起实现页面加载功能
4.今日练习
5.今日总结