收录了一些个人觉得不错的网页开发插件。
由于插件更新频繁,本页如有错误请指正,也欢迎告知更多功能强大、使用方便的插件。
插件 | 简介 | 备注 |
框架 | ||
jQuery | 最流行的 JS 框架 | 下载、中文文档、英文整合文档、中文整合文档,浏览器支持、来自 css88 的文档 官方建议 IE 6-8 使用 1.12.4 |
Angular、中文版 AngularJS (version 1.x) | 一套框架,多种平台同时适用手机与桌面 | MVC 架构,使得开发现代的单一页面应用程序(SPAs:Single Page Applications)变得更加容易 |
Vue.js | 是一套用于构建用户界面的渐进式框架。 | |
Bootstrap、中文版 | 简洁、直观、强悍的前端开发框架 | 英文文档、v3中文文档、v2中文文档、视频教程,主题和模板 |
jQuery UI | 为 jQuery 提供更丰富的功能 | 示例:Datepicker、Color Animation、Shake Effect |
功能 | ||
jQuery File Upload | jQuery 文件上传 | 英文文档 |
jQuery Cookie | 读取、写入和删除 cookie | 浏览器支持,文档 |
json2.js | json 操作库 | 已弃用,旧 IE 用 jQuery 的 parseJSON,HTML 5 用 JSON.parse |
Lightbox | 老牌图片浏览插件 推荐使用更强大的 Viewer.js | |
Swiper、中文版 | 最现代的移动触摸滑块(Most Modern Mobile Touch Slider) | 英文文档,中文文档,旧浏览器支持版本:2.x.x,Swiper 2 英文文档,中文文档 |
jquery-cropper | 图片裁剪 | |
FastClick | 用于消除手机浏览器上触摸事件触发之间的 300 毫秒延迟 | 用法,不应用的场景 |
PACE | 页面加载进度条 | 文档,IE8+ |
toastr | jQuery 通知 | 文档 |
Autosize | 一款小巧的,可自动调整 textarea 高度的独立脚本 | IE9+ |
X-editable | 允许您在页面上创建可编辑元素 | 文档,Demo |
select2 | 一款提供搜索过滤、自定义样式的下拉框插件 | |
jQuery Tags Input | 标签输入框 | 用法 |
Viewer.js | 图片浏览插件 | GitHub(viewerjs)、GitHub(jquery-viewer) jquery-viewer 是 viewerjs 的 jQuery 插件,即在 jQuery 环境中要同时引用这两个脚本。 |
PDF.js | A general-purpose, web standards-based platform for parsing and rendering PDFs. | |
编辑器 | ||
UEditor | 百度在线编辑器 | GitHub 下载、文档、ASP.NET 部署教程 |
日期时间 | ||
bootstrap-datepicker | Bootstrap 日期选择器 | Online Demo |
DateTimePicker | 日期时间选择 | |
MultiDatesPicker | 多日期选择 | |
FullCalendar | 日历日程事件工作表 | IE 9+, jQuery 2.0.0+ |
TimeTo | 计时、倒计时 | |
图表 | ||
D3.js | D3.js 是基于数据驱动文档工作方式的一款 JavaScript 函数库,主要用于网页作图、生成互动图形,是最流行的可视化库之一。 | |
Highcharts、中文版 | 兼容 IE6+、完美支持移动端、图表类型丰富、方便快捷的 HTML5 交互性图表库 | 文档 |
ECharts | 百度图表控件 | |
AntV | 来自蚂蚁金服的专业、简单、无限可能的可视化解决方案 G2 - 专业易用的可视化类库 G2-mobile - 移动端高性能可视化类库 G6 - 关系图可视化类库 | 流程图, 关系图, 可视化规范, 地图, 河流图, 力导图, 网络图, UML图, 业务流程图, 时序图 |
SyntaxHighlighter | 功能齐全的代码语法高亮插件(JS) | |
动态排名数据可视化 | 将历史数据排名转化为动态柱状图图表 开源代码,非插件,修改使用 | GitHub、视频教程、EV录屏、网页示例、视频效果 |
图标 | ||
Font Awesome | 完美的图标字体 | IE 8+,v3.2.1 支持 IE 7,进阶用法(定宽/边框/动画/旋转/叠加) |
Glyphicons | 图标字体 | 作为 Bootstrap 组件 |
Iconfont | 阿里巴巴矢量图标库 | 用户可以自定义下载多种格式的 icon,也可将图标转换为字体,便于前端工程师自由调整与调用 |
UI 框架 | ||
WeUI | 同微信原生视觉体验一致的基础样式库 | Demo、Wiki |
Apple UI Design Resources | 苹果用户界面设计资源 |
当用户向 <input> 或 <textarea> 输入时执行事件。
可用于统计输入字数,判断输入内容是否规范等。
对比事件 | 对比事件特点 | oninput 事件特点 |
onkeypress | 获得当前字符输入前的内容,不能在右键操作时执行 | 获得当前字符输入后的内容 |
onkeyup | 不能在右键操作时执行 | 在任何情况的内容变化时执行 |
onchange | 在失去焦点时执行,而且值有所改变,推荐用在 <select> 上 | 在输入时执行 |
但是通过 JS 来更改内容时不触发上述任何事件,不完美的解决方案是使用定时器。
IE8 及更早版本不支持 oninput,可以用 onpropertychange 代替。
BUG:在 IE9 的右键菜单剪切或删除中无效。
jQuery 例子:
$('#mytextarea').on('input propertychange', function () { console.log($(this).val().length); });
<input name="aaa" id="theinput" type="checkbox" />
// 选中它
$('input[name="aaa"]').prop("checked", true);
// 取消它
$('input[name="aaa"]').prop("checked", false);
// 顺便提一下将 select 选中首项
$("#ddl_types option:first").prop('selected', true);
// 获取选中的项
$('input[name="aaa"]:checked').each(function(){ });
// 获取项是否选中
$('#theinput').is(':checked')
或
$('#theinput').prop('checked')
或
theinput.checked
// 获取 radio 选中项的值
$('input[name="aaa"]:checked').val()
Demo:http://blueimp.github.io/jQuery-File-Upload/
VS 用户可以直接在 NuGet 包管理器中获得
jQuery File Upload in Asp.Net C#:http://codehandbook.org/jquery-file-upload-asp-net-csharp/
Options:https://github.com/blueimp/jQuery-File-Upload/wiki/Options
jQuery 请求代码:
$.ajax({ url: "xxxxxx", //method: "GET", // 默认 GET(当 dataType 为 jsonp 时此参数无效,始终以 GET 方式请求) data: $('#myForm').serialize(), // 要传递的参数,这里提交表单 myForm 的内容 dataType: "jsonp" //, jsonp: "callback" // 请求中的回调函数的参数名,默认值 callback //, jsonpCallback: "jQuery_abc" // 本地回调函数名,不指定则随机 }) .done(function () { alert("done"); if (true) { $('#myForm')[0].reset(); } }) .fail(function () { alert("fail"); }) .always(function () { alert("complete"); });
ASP.NET 处理代码:
JavaScriptSerializer jss = new JavaScriptSerializer(); string json = jss.Serialize(new { result = new { success = true, msg = "成功" } }); if (!string.IsNullOrWhiteSpace(Request["callback"]) && Regex.IsMatch(Request["callback"], @"[_$a-zA-Z][$\w]*")) { Response.ContentType = "application/javascript; charset=utf-8"; Response.Write(json + Request["callback"] + "(" + json + ")"); } else { Response.ContentType = "application/json; charset=utf-8"; Response.Write(json); } Response.End();
Apple’s newest devices feature the Retina Display, a screen that packs double as many pixels into the same space as older devices. For designers this immediately brings up the question, “What can I do to make my content look outstanding on these new iPads and iPhones?”. First there are a few tough questions to consider, but then this guide will help you get started making your websites and web apps look amazingly sharp with Retina images!
Things to Consider When Adding Retina Images
The main issue with adding retina images is that the images are double as large and will take up extra bandwidth (this won’t be an issue for actual iOS apps, but this guide is covering web sites & web apps only). If your site is mostly used on-the-go over a 3G network it may not be wise to make all your graphics high-definition, but maybe choose only a select few important images. If you’re creating something that will be used more often on a WI-FI connection or have an application that is deserving of the extra wait for hi-res graphics these steps below will help you target only hi-res capable devices.
Simple Retina Images
The basic concept of a Retina image is that your taking a larger image, with double the amount of pixels that your image will be displayed at (e.g 200 x 200 pixels), and setting the image to fill half of that space (100 x 100 pixels). This can be done manually by setting the height and width in HTML to half the size of your image file.
<img src="my200x200image.jpg" width="100" height="100">
If you’d like to do something more advanced keep reading below for how you can apply this technique using scripting.
Creating Retina Icons for Your Website
When users add your website or web app to their homescreen it will be represented by an icon. These sizes for regular and Retina icons (from Apple) are as follows:
iPhone | 57 x 57 |
---|---|
Retina iPhone | 114 x 114 |
iPad | 72 x 72 |
Retina iPad | 144 x 144 |
For each of these images you create you can link them in the head of your document like this (if you want the device to add the round corners remove -precomposed):
<link href="touch-icon-iphone.png" rel="apple-touch-icon-precomposed" />
<link href="touch-icon-ipad.png" rel="apple-touch-icon-precomposed" sizes="72x72" />
<link href="touch-icon-iphone4.png" rel="apple-touch-icon-precomposed" sizes="114x114" />
<link href="touch-icon-ipad3.png" rel="apple-touch-icon-precomposed" sizes="144x144" />
If the correct size isn’t specified the device will use the smallest icon that is larger than the recommended size (i.e. if you left out the 114px the iPhone 4 would use the 144px icon).
Retina Background Images
Background images that are specified in your CSS can be swapped out using media queries. You’ll first want to generate two versions of each image. For example ‘bgPattern.png’ at 100px x 100px and ‘bgPattern@2x.png’ at 200px x 200px. It will be useful to have a standard naming convention such as adding @2x for these retina images. To add the new @2x image to your site simply add in the media query below (You can add any additional styles that have background images within the braces of the same media query):
.repeatingPattern {
background: url(../images/bgPattern.png) repeat;
background-size: 100px 100px;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
.repeatingPattern {
background: url(../images/bgPattern@2x.png) repeat;
}
}
JavaScript for Retina Image Replacement
For your retina images that aren’t backgrounds the best option seems to be either creating graphics with CSS, using SVG, or replacing your images with JavaScript. Just like the background images, you’ll want to create a normal image and one ‘@2x’ image. Then with JavaScript you can detect if the pixel ratio of the browser is 2x, just like you did with the media query:
if (window.devicePixelRatio == 2) {
//Replace your img src with the new retina image
}
If you’re using jQuery you could quickly replace all your images like this very basic example below. It’s a good idea to add a class to identify the images with hi-res versions so you don’t replace any others by mistake. I’ve added a class=”hires” for this example. Also make sure you have the standard (non-retina) image height and width set in the HTML:
<img class="hires" alt="" src="search.png" width="100" height="100" />
<script type="text/javascript">
$(function () {
if (window.devicePixelRatio == 2) {
var images = $("img.hires");
// loop through the images and make them hi-res
for(var i = 0; i < images.length; i++) {
// create new image name
var imageType = images[i].src.substr(-4);
var imageName = images[i].src.substr(0, images[i].src.length - 4);
imageName += "@2x" + imageType;
//rename image
images[i].src = imageName;
}
}
});
</script>
Server-Side Retina Images
If you’d like to implement a server-side retina image solution, I recommend checking out Jeremy Worboys’ Retina Images (which he also posted in the comments below). His solution uses PHP code to determine which image should be served. The benefit of this solution is that it doesn’t have to replace the small image with the retina one so you’re using less bandwidth, especially if you have lots of images that you’re replacing.
Website Optimization for Retina Displays
If you’re looking for additional information on creating Retina images, I’ve recently had a short book published called Website Optimization for Retina Displays that covers a range of related topics. It contains some of what is above, but also includes samples for many different situations for adding Retina images. It explains the basics of creating Retina images, backgrounds, sprites, and borders. Then it talks about using media queries, creating graphics with CSS, embedding fonts, creating app icons, and more tips for creating Retina websites.
在使用jQuery时,VS2008有提供整合jQuery IntelliSense,
这样在写jQuery时更简单容易,
设定的方式如下:
安装VS2008 sp1 (已经安装过就可以跳过此步骤)
安装 hotfix 让VS2008 可以自动去读取 “-vsdoc.js”来提供Javascript Lib 的 InterlliSense
下载 jQuery-1.3.2.min.js 以及 jQuery-1.3.2-vsdoc2.js
将 jQuery-1.3.2.min.js 重新命名为 jQuery-1.3.2.js
将 jQuery-1.3.2-vsdoc2.js 重新命名为 jQuery-1.3.2-vsdoc.js
将 jQuery-1.3.2.js 以及 jQuery-1.3.2-vsdoc.js 加入到专桉裡
在vs2008编辑Javascript时,点选 "编辑”/“IntelliSense”/”更新JScript IntelliSense”
结果 左下角显示 " 更新JScript IntelliSense 时发生错误,请参阅错误清单”
错误内容为 "'div.childNodes' 是 null 或不是一个物件"
请打开 jQuery-1.3.2-vsdoc.js
将其中一段
elem = jQuery.makeArray( div.childNodes );
替换成if (div && div.childNodes) elem = jQuery.makeArray( div.childNodes );
再重新 点选 "编辑”/“IntelliSense”/”更新JScript IntelliSense”完工
补充: 步骤2 的hotfix 可以选择性安装,如果没有安装的话,必须自己在页面加上
<script src="Js/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
有安装hotfix的话vs2008会自动去读取相同档名,但是后面带有-vsdoc的档桉产生IntelliSense内容,建议是安装,这样就不用每次使用都要加上 -vsdoc.js
另外分享几个小技巧
如果要在 js档 裡面使用 IntelliSense 的话,可以加上这行
/// <reference path="~/js/jquery-1.3.2.js" />
如果要在 MasterPage 或是 使用者控制项(User Control) ,使用 IntelliSense ,又怕跟主页面重複一直呼叫 js 档,可以利用这方法<% if(false) { %>
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<% } %>
这样就可以在设计阶段有 IntelliSense ,在执行阶段时又不会被输出到页面。