设置右侧默认滚动条的样式
Styling the default scrollbar on the right
嗨,在过去的一个小时里,我一直在尝试更改浏览器上默认滚动条的外观。我说的是右边的主滚动条没有加载新的滚动条并阻碍它。我正在使用jScrollPane插件,但它似乎不起作用,或者我做得不对。这是我的代码:
$("window").jScrollPane();
window
{
width: 100%;
overflow: auto;
}
window
{
height: auto;
}
如果你访问A.K.链接的网站,你会看到必要的Jquery和CSS。我让你更容易理解它们。
$(function()
{
var win = $(window);
// Full body scroll
var isResizing = false;
win.bind(
'resize',
function()
{
if (!isResizing) {
isResizing = true;
var container = $('#full-page-container'); //this should be the most parent
// div, right beneath the <body> and covering the entire page. Change the ID HERE.
// Temporarily make the container tiny so it doesn't influence the
// calculation of the size of the document
container.css(
{
'width': 1,
'height': 1
}
);
// Now make it the size of the window...
container.css(
{
'width': win.width(),
'height': win.height()
}
);
isResizing = false;
container.jScrollPane( //this is where outer scroll changes
{
'showArrows': true
}
);
}
}
).trigger('resize');
// Workaround for known Opera issue which breaks demo (see
// http://jscrollpane.kelvinluck.com/known_issues.html#opera-scrollbar )
$('body').css('overflow', 'hidden');
// IE calculates the width incorrectly first time round (it
// doesn't count the space used by the native scrollbar) so
// we re-trigger if necessary.
if ($('#full-page-container').width() != win.width()) {
win.trigger('resize');
}
/*Internal scrollpanes. (Not needed if you want to change only the outer)
$('.scroll-pane').jScrollPane({showArrows: true});
*/
});
现在CSS:
html
{
overflow: auto;
}
#full-page-container
{
overflow: auto;
}
/*** Optional INNER scrolls.
.scroll-pane
{
width: 100%;
height: 200px;
overflow: auto;
}
.horizontal-only
{
height: auto;
max-height: 200px;
}
***/
不要忘记包含Jquery、jscrollpane.css、mousewheel.js、jscroll pane.js
相关文章:
- CSS-若窗口太小,滚动条会出现在“表格”单元格上
- 禁用(而不是隐藏)浏览器滚动条
- 在firefox和chrome中的左侧显示iframe滚动条
- 条件滚动条样式
- 设置右侧默认滚动条的样式
- JScrollpane不会设置滚动条的样式
- JQuery:手风琴高度样式:填充导致垂直滚动条
- 可以在 gwt 中设置本机滚动条的样式,无需定义自定义滚动条,也无需使用 ScrollPanel 或 CustomScr
- 样式 Facebook 喜欢框滚动条
- 滚动条在 Firefox 中显示的样式与 Chrome 不同
- 如何实现脸书聊天垂直滚动条样式
- 如何自定义twitter iframe滚动条的样式
- 更改滚动条样式
- 只改变iframe的滚动条样式
- 如何改变滚动条样式或隐藏滚动条在浏览器通过javascript或css
- 自定义样式的滚动条
- 如何隐藏默认样式的滚动条,当我使用overflow:scroll;
- 将webkit滚动条样式应用于文本区域
- JS/jQuery样式的滚动条
- 禁止使用MarginLeft样式更改滚动条