Skip to content

Instantly share code, notes, and snippets.

View libo1106's full-sized avatar

libo libo1106

View GitHub Profile
@libo1106
libo1106 / gist:4618713
Created January 24, 2013 08:29
position:relative元素在IE7下面,通过JS交互后位置异常补丁
/*
* 通过重绘来修复此bug,给位置异常元素添加上.bug_fixed
*/
function bug_fixed_for_ie(){
$('.bug_fixed').each(function(i){
this.className = this.className;
});
}
@libo1106
libo1106 / gist:4632907
Last active December 11, 2015 17:09
在浮动布局中的下拉菜单
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>下拉菜单</title>
<style type="text/css">
.relative{
position: relative;
}
.content{
@libo1106
libo1106 / gist:4705781
Created February 4, 2013 09:17
跨浏览器box-shadow
.sl-shadow{
/* modern web browsers */
-moz-box-shadow:1px 3px 12px #bbb;
-webkit-box-shadow:1px 3px 12px #bbb;
box-shadow:1px 3px 12px #bbb;
/* 一定要设置background, 不然 ie 会显示在字体上 */
background: #fff;
/* gte=ie8 */
@libo1106
libo1106 / gist:4974975
Created February 18, 2013 03:40
锚点平滑滚动
$('a').click(function(){
var href = $(this).attr("href");
var pos = $(href).offset().top;
$("html,body").animate({scrollTop: pos}, 1000);
return false;
});
// 参考网址
// http://www.zhangxinxu.com/wordpress/2010/07/锚点跳转及jquery下相关操作与插件/
@libo1106
libo1106 / gist:4976106
Last active December 13, 2015 21:18
去除focus中的虚线框
<html>
<head>
<style>
a:focus{
outline:none;
}
</style>
</head>
<body>
<a href="#" hidefocus="true" >链接</a>
@libo1106
libo1106 / gist:5029072
Created February 25, 2013 10:47
搜索框提示按钮
/* 搜索框 */
if( $('.search').length != 0){
var search = $('.search');
var search_enter = $('.search_enter');
search_enter.hide();
search.on({
keyup : function(){
console.log('keyup');
search.val().length != 0 ? search_enter.show() : search_enter.hide();
},
@libo1106
libo1106 / jqmData(rel='back')
Created May 8, 2013 11:13
为jQuery Mobile的全局返回添加tap事件(即采用touch事件)
$(:jqmData(rel='back')).tap(function(e){
$.mobile.back();
return false;
})
@libo1106
libo1106 / css-triangle
Last active December 17, 2015 20:39
css-triangle 兼容IE6
.triangle_left,
.triangle_down,
.triangle_right,
.triangle_up{
border:5px dashed transparent;
width:0;
height:0;
font-size:0;
overflow:hidden
}
@libo1106
libo1106 / gist:5956669
Created July 9, 2013 11:31
让软件走代理
Proxifier工具
@libo1106
libo1106 / big-bg-img
Created July 16, 2013 10:30
自适应大背景
/*
* background-attachment: fixed必须有,保证浏览器完整渲染背景图
*/
html {
background: url(images/perfect-full-page-bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}