如何将Windows默认滚动条设置为特定div? [英] How to have a windows default scroll bar to particular div?

查看:85
本文介绍了如何将Windows默认滚动条设置为特定div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带页眉和页脚的屏幕。在身体里,我有桌子。我必须修复表的标题。我已经完成了。但问题是当表列动态附加到表时,垂直滚动条显示在页脚下方。但我想要的是窗口滚动条必须在页脚上方。



我用来固定表头的插件是,



我尝试过的事情:



Js:



$(document).ready(function(){

$(。header)。stickyTableHeaders();

});

I have a screen with headers and footers. In the body, i am having the table . I have to fix the headers of table. I have already done. But the problem is when the table columns are appending dynamically to table, the vertical scrollbar is displayed below the footer. But what i want is window scroll bar must be above the footer.

The plugin i have used for fixing of table headers is ,

What I have tried:

Js:

$(document).ready(function(){
$(".header").stickyTableHeaders();
});

推荐答案

(document).ready(function(){
(document).ready(function(){


(。header)。stickyTableHeaders();

});
(".header").stickyTableHeaders();
});


默认情况下,div的大小(或 block 的任何其他元素显示)由其内容定义,因此不能有任何滚动条。如果通过CSS修改div行为,则会出现滚动条或两者。



首先,您需要将div宽度和/或高度更改为固定(永远不固定,但不是'自动')。其次,您需要指定在div的内容溢出时要做什么,也就是说,如果某些内容超出了div的客户区域,该怎么办(可能你明白这是滚动的全部目的)。具体如下:

溢出 - CSS | MDN [ ^ ]。



对于自定义溢出处理,另请参阅:溢出 - 事件引用| MDN [ ^ ]。



这只是回答了帖子标题中陈述的问题。但是为什么你认为这个问题真正解释了你的问题呢?这是相关的,是的,但可能更复杂。当你在谈论表格区域的垂直滚动条时,有些东西告诉我你需要滚动表格而不是div,而对于更复杂的布局,你可能需要滚动表格区域,除了标题的部分,应该固定在滚动区域的顶部。如果是这样,这是一个非常受欢迎的问题;你可以找到许多这种布局的样本:滚动表,固定听众 [ ^ ]。



特别请看:

< a href =https://jsfiddle.net/dPixie/byB9d/3> HTML表纯CSS固定标题 - JSFiddle [ ^ ],

圣杯:带固定标题的纯CSS滚动表 [ ^ ]。



如果这不是你想要的,你需要展示你的代码,更全面地解释你期望达到的目标,你观察到了什么相反,为什么你觉得这是错的。



-SA
By default, the size of the div (or any other element with block display) is defined by its content, so there cannot be any scroll bars. A scroll bar, or both of them, will appear if you modify the div behavior via CSS.

First, you need to change the div width and/or height to fixed (not fixed forever but not 'auto'). Second, you need to specify what to do on overflow of the div's content, that is, what to do if some content goes out of the client area of your div (probably you understand that this is the whole purpose of scrolling). This is how:
overflow — CSS | MDN[^].

For custom overflow handling, see also: overflow — Event reference | MDN[^].

This merely answers the question stated in the title of your post. But why do you think that your problem is really explained by this issue? It is related, yes, but can be more complicated. As you are talking about the vertical scroll bar of the table area, something tells me that you need to scroll the table, not div, and, for a more complicated layout, you probably need to scroll the table area except the header's part, which should be fixed on top of the scrolled area. If so, this is a very popular question; you can find many samples of such layout: scroll table, fixed hearers[^].

In particular, please see:
HTML table pure CSS fixed header — JSFiddle[^],
The Holy Grail: Pure CSS Scrolling Tables with Fixed Headers[^].

If this is not what you want, you need to show your code, explain more thoroughly what you expected to achieve, what did you observe instead and why do you feel it was wrong.

—SA


这篇关于如何将Windows默认滚动条设置为特定div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆