1.操作cookie的插件jquery.cookie.js
添加
$.cookie('the_cookie', 'the_value');
设置时长
$.cookie('the_cookie', 'the_value', { expires: 7 });
设置路径
对于正在学习web前端但不知道学习路线,不知道学习方法,不知道该如何找到工作的朋友,我还是要推荐下我自己建的前端学习群:330242580,首先你要是学前端的,其次不管你是小白还是大牛,小编都挺欢迎,群里每天都会分享前端相关干货,包括我自己(一名工作六年的前端老司机)最近熬夜花了一星期整理出的一份适合2017年自学的最新web前端资料,都送给大家,欢迎初学和进阶中的小伙伴。
$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });
读取
$.cookie('the_cookie'); // cookie存在 => 'the_value'
$.cookie('not_existing'); // cookie不存在 => null
删除
$.cookie('the_cookie', null);
3.将cookie写入文件
var COOKIE_NAME = 'username';
if( $.cookie(COOKIE_NAME) ){
$('#username').val( $.cookie(COOKIE_NAME) );
}
$('#check').click(function{
if(this.checked){
$.cookie(COOKIE_NAME, $('#username').val , { path: '/', expires: 10, domain: 'jquery.com', secure: true });
//var date = new Date;
//date.setTime(date.getTime + (3 * 24 * 60 * 60 * 1000)); //三天后的这个时候过期
//$.cookie(COOKIE_NAME, $('#username').val, { path: '/', expires: date });
}else{
$.cookie(COOKIE_NAME, null, { path: '/' }); //删除cookie
}
});
2.wow.js实用的滚动插件
HTML书写
div class='wow slideInLeft'div
可以加入 data-wow-duration(动画持续时间)和 data-wow-delay(动画延迟时间)属性,如:
div class='wow slideInLeft' data-wow-duration='2s' data-wow-delay='5s'>div
JavaScript部分
new WOW.init;
如果需要自定义配置,可如下使用:
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: 0,
mobile: true,
live: true
});
wow.init;
3.numscroller.js / countUP数字滚动增加插件
HTML书写
script type='text/javascript' src='../js/jquery.js'>
div中必须有类 numscroller 和 data-slno data-min data-max data-delay data-increment 等属性
JS初始化
jQuery(function($) {
$('.timer').countTo({
lastSymbol:' %', //显示在最后的字符
from: 0, // 开始时的数字
speed: 2000, // 总时间
refreshInterval: 10, // 刷新一次的时间
beforeSize:0, //小数点前最小显示位数,不足的话用0代替
decimals: 2, // 小数点后的位数,小数做四舍五入
onUpdate: function {
}, // 更新时回调函数
onComplete: function {
for(i inarguments){
console.log(arguments[i]);
}
}
});
});
4.uploadfive.js带进度条文件上传插件
用法
script src='jquery.min.js' type='text/javascript'>
script src='jquery.uploadifive.min.js' type='text/javascript'>
href='uploadifive.css'>
联系客服