Category: Javascript /Jquery / React / Bootstrap / Web
主页:http://momentjs.cn/
文档:http://momentjs.cn/docs/
项目地址:https://github.com/moment/moment/
下载:moment-develop
引用:
http://sources.ikeepstudying.com/js/moment-2.10.6.js (未压缩)
http://sources.ikeepstudying.com/js/moment.min-2.18.1.js (压缩版)
http://sources.ikeepstudying.com/js/moment-with-locales-2.10.6.js (支持多语言)
&…
Read More
主页:http://swisnl.github.io/jQuery-contextMenu/
项目地址:https://github.com/swisnl/jQuery-contextMenu
下载:jQuery-contextMenu-master
文档:https://swisnl.github.io/jQuery-contextMenu/demo.html
$.contextMenu is a management facility for – you guessed it – context menus. It was designed for an application where there are hun…
Read More
throttle 与 debounce 都是为了限制函数的执行频次,以优化函数触发频率过高导致的响应速度跟不上触发频率,出现延迟,假死或卡顿的现象。
概念
throttle:连续的时间间隔(每隔一定时间间隔执行callback)。
debounce:空闲的时间间隔(callback执行完,过一定空闲时间间隔再执行callback)。
电梯超时
想象每天上班大厦底下的电梯。把电梯完成一次运送,类比为一次函数的执行和响应。假设电梯有两种运行策略 throttle 和 debounce ,超时设定为15秒,不考虑容量限制。
throttle 策略的电梯。保证如果电梯第一个人进来后,15秒后准时运送一次,不等待。如果没有人,则待…
Read More
$(document).ready(function(){
document.oncontextmenu = function() {return false;};
$(document).mousedown(function(e){
if( e.button == 2 ) {
alert('Right mouse button!');
return false;
}
return true;
});
});
本文:jQuery:绑定鼠标右击事件 Bind event to
主页:http://hemantnegi.github.io/jquery.sumoselect/
项目:https://github.com/HemantNegi/jquery.sumoselect
下载:jquery.sumoselect-master
DEMO: http://hemantnegi.github.io/jquery.sumoselect/sumoselect_demo.html
简单介绍
jquery.sumoselect是一款跨设备、跨浏览器的jQuery下拉列表框插件。该jQuery下拉列表框插件可以单选,也可以多选。它的样式可以通过CSS文件来自定义。它的最大特点是可以跨设备…
Read More
核心代码:
var $tr = $(this).closest('.tr_clone');
var $clone = $tr.clone();
$clone.find(':text').val('');
$tr.after($clone);
实例:
HTML:
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="table-data">
<tr>
<td>Name</td>
<td>Location</td>
<td>From</td>
<td>To&…
Read More
什么是localStorage?
在HTML5中,新加入了一个localStorage特性,这个特性主要是用来作为本地存储来使用的,解决了cookie存储空间不足的问题(cookie中每条cookie的存储空间为4k),localStorage中一般浏览器支持的是5M大小,这个在不同的浏览器中localStorage会有所不同
localStorage的优势
1、localStorage拓展了cookie的4K限制
2、localStorage会可以将第一次请求的数据直接存储到本地,这个相当于一个5M大小的针对于前端页面的数据库,相比于cookie可以节约带宽,但是这个却是只有在高版本的浏览器中才支持…
Read More
项目地址:https://github.com/jmosbech/StickyTableHeaders
下载:StickyTableHeaders-master
实例演示: DEMO.
StickyTableHeaders
So what’s it good for? Well, let’s say you want to display a long list of fairly uniform tabluar data, like stock exchange listings or sport statistics but you don’t want your users to get lost in the…
Read More
原代码:
$(document).on("mouseover","td.editable",editable_input);
function editable_input()
{
var $editable_type = $(this).attr('editable_type');
if($editable_type == 'text' || $editable_type == 'textarea')
{
$(this).editable(BASEPATH + "/editable", {
indicator : '<img src="'+BASEURL+'public/assets/indicator.gif" />',
typ…
Read More
主页:https://select2.github.io/
项目:https://github.com/select2/select2
实例:https://select2.github.io/examples.html
下载:select2-4.0.3
select2是一个可以给你定制支持搜索、标签、远程数据集,无限滚动,以及其他常用功能的一个下拉框美化插件。总之,功能很强大。
配置
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
<…
Read More
主页:http://vodkabears.github.io/remodal/
项目地址:https://github.com/VodkaBears/Remodal
下载:Remodal-master
用法:
载入css和js文件
<link rel="stylesheet" href="../dist/remodal.css">
<link rel="stylesheet" href="../dist/remodal-default-theme.css">
<script src="../dist/jquery.min.js"></script>
<script s…
Read More
错误实例:
$("#div").addClass("error").delay(1000).removeClass("error");
一般有三种解决方法:
1. You can use setTimeout() function:
$(document).ready(function () {
var $rows = $("#rowone.one, #rowtwo.three, #rowthree.two").addClass("pageLoad");
setTimeout(function() {
$rows.removeClass("pageLoad");
}, 1000);
});
2. You can create a new queue i…
Read More
利用 Sheets API,您可以向单元格、范围、范围集以及整个工作表写入值和公式。 本页面上的示例说明了如何使用此 API 的 spreadsheets.values 集合实现一些常用的写入操作。
请注意,也可以使用 spreadsheet.batchUpdate 方法写入单元格值,如果您希望同步更新单元格格式设置或 spreadsheets.values 集合不会影响的其他属性,此方法将非常实用。不过,对于简单的值写入操作,使用 spreadsheets.values.update 或 spreadsheets.values.batchUpdate 更简单。
在这些示例中,占位符 spreadsheetId 用于表示您需要提供…
Read More
利用 Sheets API,您可以读取单元格、范围、范围集以及整个工作表中的值。 本页面上的示例说明了如何使用此 API 的 spreadsheets.values 集合实现一些常用的读取操作。您也可以使用 spreadsheets.get 方法读取单元格值,不过在大多数情况下,使用 spreadsheets.values.get 或 spreadsheets.values.batchGet 更加简单。
在这些示例中,占位符 spreadsheetId 用于表示您需要提供电子表格 ID 的位置,可以从电子表格网址中找到此 ID。要读取的范围在请求网址中使用 A1 表示法指定。
这些示例均假设要读取的电子表格在其第一个工作表(“Sheet…
Read More