1.操作cookie的插件jquery.cookie.js 添加 $.cookie('the_cookie', 'the_value'); 設(shè)置時(shí)長(zhǎng) $.cookie('the_cookie', 'the_value', { expires: 7 }); 設(shè)置路徑
$.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寫(xiě)入文件 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)); //三天后的這個(gè)時(shí)候過(guò)期 //$.cookie(COOKIE_NAME, $('#username').val, { path: '/', expires: date }); }else{ $.cookie(COOKIE_NAME, null, { path: '/' }); //刪除cookie } }); 2.wow.js實(shí)用的滾動(dòng)插件 HTML書(shū)寫(xiě) div class='wow slideInLeft'div 可以加入 data-wow-duration(動(dòng)畫(huà)持續(xù)時(shí)間)和 data-wow-delay(動(dòng)畫(huà)延遲時(shí)間)屬性,如: 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數(shù)字滾動(dòng)增加插件 HTML書(shū)寫(xiě) script type='text/javascript' src='../js/jquery.js'> 90 div中必須有類(lèi) numscroller 和 data-slno data-min data-max data-delay data-increment 等屬性 JS初始化 jQuery(function($) { $('.timer').countTo({ lastSymbol:' %', //顯示在最后的字符 from: 0, // 開(kāi)始時(shí)的數(shù)字 speed: 2000, // 總時(shí)間 refreshInterval: 10, // 刷新一次的時(shí)間 beforeSize:0, //小數(shù)點(diǎn)前最小顯示位數(shù),不足的話用0代替 decimals: 2, // 小數(shù)點(diǎn)后的位數(shù),小數(shù)做四舍五入 onUpdate: function { }, // 更新時(shí)回調(diào)函數(shù) onComplete: function { for(i inarguments){ console.log(arguments[i]); } } }); }); 4.uploadfive.js帶進(jìn)度條文件上傳插件 用法 script src='jquery.min.js' type='text/javascript'> script src='jquery.uploadifive.min.js' type='text/javascript'> href='uploadifive.css'> |
|