Get vertical scrollbar width and example
$.scrollbarWidth = function () {
var parent, child, width;
if (width === undefined) {
parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body');
child = parent.children();
width = child.innerWidth() - child.height(99).innerWidth();
parent.remove();
}
return width;
};
Usage
function setWidth() {
var scrollbarwidth = $.scrollbarWidth();
$('#targetDiv').css({ 'width': ($('#srcDiv').width() - scrollbarwidth) + "px" });
}
Get vertical scrollbar width and example的更多相关文章
- HTML精确定位之位置参数乱炖一锅
一.前言 公司项目,需要在一个图片的右上角放置一个类似“X”的东西(其实是需要显示一个数字,就像微信一样,在右上角显示几个消息),然后需要用到html的定位,看了几个网上的例子,恍惚间看到了一个off ...
- Android WebView ScrollBar设置
WebView wv; wv.setVerticalScrollBarEnabled(false); 取消Vertical ScrollBar显示 wv.setHorizontalScrollBar ...
- CSS3与页面布局学习总结(二)——Box Model、边距折叠、内联与块标签、CSSReset
一.盒子模型(Box Model) 盒子模型也有人称为框模型,HTML中的多数元素都会在浏览器中生成一个矩形的区域,每个区域包含四个组成部分,从外向内依次是:外边距(Margin).边框(Border ...
- [C1] 仿 Excel 实现(C1FlexGrid)
一 分析阶段 根据 Excel 表格区域的划分,如下图,基本上以4行*3列的框架搭建: 第一行为列头区域 ==> C1FlexGrid.ColumnHeaders 第二行为单元格区域 ...
- Android View的绘制流程
写得太好了,本来还想自己写的,奈何肚里墨水有限,直接转吧.正所谓前人种树,后人乘凉.. View的绘制和事件处理是两个重要的主题,上一篇<图解 Android事件分发机制>已经把事件的分发 ...
- css的初始化样式
一切为了敏捷开发: http://blog.sina.com.cn/s/blog_71ed1b870101a52w.html CSS初始化示例代码 /* css reset www.admin1000 ...
- Box Model,边距折叠,内联和块标签,CSSReset
一.盒子模型(Box Model) 1.1.宽度测试 1.2.溢出测试 1.3.box-sizing属性 1.4.利用CSS画图 二.边距折叠 2.1.概要 2.2.垂直方向外边距合并计算 三.内联与 ...
- jquery——移动端滚动条插件iScroll.js
官网:http://cubiq.org/iscroll-5 demo: 滚动刷新:http://cubiq.org/dropbox/iscroll4/examples/pull-to-refresh/ ...
- jqGrid配置属性说明
Property Type Description Default1) ajaxGridOptions object This option allows to set global ajax set ...
随机推荐
- PAT 1018
1018. Public Bike Management (30) There is a public bike service in Hangzhou City which provides gre ...
- Android中常用适配器及定义自己的适配器
转载:http://blog.chinaunix.net/uid-11898547-id-3303153.html http://www.tudou.com/home/_328390108/item ...
- java_闭包和回调实现一边按键盘一边演讲
package ming; interface Teachable { void work(); } class Programer { private String name; public Str ...
- Scala Error: error while loading Suite, Scala signature Suite has wrong version expected: 5.0 found: 4.1 in Suite.class
准备给scala项目引入单元测试 <dependency> <groupId>org.scalatest</groupId> <artifactId>s ...
- java_字符
例一:数据类型转换 package javaweb1200; public class 字符就是数字吗 { public static void main(String[] args) { Syste ...
- Linux编程之《进程/线程绑定CPU》
Intro----- 通常我们在编写服务器代码时,可以通过将当前进程绑定到固定的CPU核心或者线程绑定到固定的CPU核心来提高系统调度程序的效率来提高程序执行的效率,下面将完整代码贴上. /***** ...
- git workflows
https://www.atlassian.com/git/tutorials/comparing-workflows Comparing Workflows The array of possibl ...
- Mac OS恢复出厂系统方法
1.重新启动时按住“Command()”和"R"键盘 2.选择磁盘工具
- ubuntu禁用笔记本自带键盘
ubuntu如何禁用笔记本键盘 打开终端运行命令 xinput list Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core ...
- [改善Java代码]不要主动进行垃圾回收
建议51: 不要主动进行垃圾回收 很久很久以前,在Java 1.1的年代里,我们经常会看到System.gc这样的调用—主动对垃圾进行回收.不过,在Java知识深入人心后,这样的代码就逐渐销声匿迹了— ...