Skip to content

Instantly share code, notes, and snippets.

View plutochill's full-sized avatar

Chill plutochill

View GitHub Profile
@plutochill
plutochill / 溢出显示省略.html
Created April 17, 2014 05:51
多行文本溢出显示省略号(...)的方法
//jquery
//从后向前逐个删除末尾字符,直至元素的高度小于父元素高度
$(".figcaption").each(function(i){
var divH = $(this).height();
var $p = $("p", $(this)).eq(0);
while ($p.outerHeight() > divH) {
$p.text($p.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, "..."));
};
});
@plutochill
plutochill / PNGHackIE6.css
Last active January 4, 2016 07:59
PNG Hack/Fix for IE 6
/*For CSS background-images*/
.yourselector {
width:200px;
height:100px;
background: url(/folder/yourimage.png) no-repeat;
_background:none;
_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/folder/yourimage.png',sizingMethod='crop');
}
@plutochill
plutochill / email.html
Last active December 28, 2015 04:39
邮件模板
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body style="margin: 0; padding: 0;">
<table border="1" cellpadding="0" cellspacing="0" width="100%">
@plutochill
plutochill / global.css
Created November 13, 2013 03:50
css:通用框架样式
/*
*重置
*/
html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,caption,th,td,form,fieldset,legend,input,button,textarea,menu{margin:0;padding:0;}
header,footer,section,article,aside,nav,hgroup,address,figure,figcaption,menu,details{display:block;}
table{border-collapse:collapse;border-spacing:0;}
html,body,fieldset,img,iframe,abbr{border:0;}
i,cite,em,var,address,dfn{font-style:normal;}
li{list-style:none;}
@plutochill
plutochill / returnObjectType.js
Created September 25, 2013 03:30
返回各种对象的类型
var toType = function(obj) {
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
};
@plutochill
plutochill / jquery:平滑滚动页面到某个锚点
Created September 23, 2013 14:29
平滑滚动页面到某个锚点
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
@plutochill
plutochill / jquery:图片预加载
Created September 23, 2013 14:28
图片预加载
(function($) {
var cache = [];
// Arguments are image paths relative to the current page.
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
@plutochill
plutochill / sublimeText2:常用快捷键
Created September 15, 2013 01:36
需要时查一下最常用的快捷键,方便使用
Ctrl+Shift+P:打开命令面板
Ctrl+P:搜索项目中的文件
Ctrl+G:跳转到第几行
Ctrl+W:关闭当前打开文件
Ctrl+Shift+W:关闭所有打开文件
Ctrl+Shift+T: 打开刚刚关闭的标签
Ctrl+Shift+V:粘贴并格式化
Ctrl+D:选择单词,重复可增加选择下一个相同的单词
Ctrl+L:选择行,重复可依次增加选择下一行
Ctrl+Shift+L:选择多行
@plutochill
plutochill / jquery:鼠标经过延时
Created September 15, 2013 01:26
让鼠标经过事件和延时分离的出来,延时以及延迟的清除都已经由此方法解决了
(function($){
$.fn.hoverDelay = function(options){
var defaults = {
hoverDuring: 200,
outDuring: 200,
hoverEvent: function(){
$.noop();
},
outEvent: function(){
$.noop();