作者:书友59082326 | 来源:互联网 | 2023-05-18 13:12
Well,iamstuckedandcantfindtheanswermyself.Hopefullysomeonecangivemeahint.好吧,我被困了,自
Well, i am stucked and can't find the answer myself. Hopefully someone can give me a hint.
好吧,我被困了,自己找不到答案。希望有人可以给我一个提示。
I try to fullfill the following requirements:
我尝试满足以下要求:
- There should be a Newsblock within a HTML Page with a fixed width and height.
HTML页面中应该有一个具有固定宽度和高度的新闻块。
- In this Newsblock only the title of the news are visible.
在这个新闻块中,只有新闻标题可见。
- Those news are "collapsed" by default and should "expand" if the Mouse is over it.
默认情况下,这些新闻会“崩溃”,如果鼠标位于其上,则应该“展开”。
- Due the fact that the 'Newsblock' is limited by its height, there should be a Scrollbar visible. But only if the currently expanded news makes it necessary, so the user can Scroll down.
由于“新闻块”受其高度的限制,因此应该可以看到滚动条。但只有当前扩展的新闻使其成为必要时,用户才能向下滚动。
- Newstitle and Newstext should never leave the Newsblock.
Newstitle和Newstext永远不应该离开Newsblock。
so far so good, i was able to fullfill all those demands except the one with the Scrollbar. If i try to reach the Scrollbar out of the currently expanded news it collapses again and the Scrollbar disappears. I understand that my .hover is configured that it always SlideUp if i leave the newsentry and the Scrollbar isn't a part of the newsentry div. But i have no idea what to change to still have an overall Scrollbar for the Newsblock, but won't disappear if i try to 'reach' it.
到目前为止一切顺利,我能够满足所有这些要求,除了带有滚动条的那个。如果我尝试从当前扩展的新闻中获取滚动条,它会再次折叠并且滚动条消失。我知道我的.hover配置为如果我离开newsentry并且Scrollbar不是newsentry div的一部分它总是SlideUp。但我不知道要改变什么仍然有新闻块的整体滚动条,但如果我试图“达到”它将不会消失。
P.s.: A Scrollbar only per Newsentry looks weird. Thats why i want 'bind' the scrollbar to the parent container :S
P.s。:只有Newsentry的Scrollbar看起来很怪异。这就是为什么我想把滚动条'绑定'到父容器:S
HTML
// some auto generated div's i have to life with, so the news entries are not 'direct' children of the newsblock.
... another 9 'newsentry' divs.
JS
$(".newsentry").hover(
function() {
$(this).children(".newstext").stop(true,true).slideDown();
},
function() {
$(this).children(".newstext").stop(true,true).slideUp();
}
);
CSS
.newsblock {
height: 200px;
overflow-y: auto;
}
4 个解决方案