简体   繁体   English

在div结束时溢出无法正常工作

[英]Overflow not working when at end of the div

The paragraphs in my div create a second line when hovering - 我的div中的段落在悬停时会创建第二行-

If you scroll to the end of the box you can see that if you hover over the last paragraph and while its second line is extended that if you then scroll down as far as you can go, the paragraphs will then glitch and the overflow will not extend any further, I think because the max of the overflow has been reached it won't extend any further, what can I do? 如果滚动到该框的末尾,您会看到,如果将鼠标悬停在最后一段上,并且在第二行延长的同时,向下滚动到尽可能远的位置,则这些段落将出现故障,并且溢出不会我想进一步扩展,因为已经达到溢出的最大值,所以不会进一步扩展,该怎么办?

 node = ["systems development highways junior", "Dale", "efefefefe efef", "dadadadada dadadad adadadadadad", "systems biggest development pot ever in the hands of the most junior fishermen", "systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen", ] d3.selectAll('#titleTable').selectAll('td') .data(node) .enter() .append('divname') .html(node => { if (node && node.length > 35) { var before = node.slice(0, node.indexOf(' ', 28)); var after = node.slice(node.indexOf(' ', 24)); var beforeReplacementParagraph = node.slice(0, node.indexOf(' ', 24)); return ` <p class="nodeParagraph"> <span class="hide-on-hover">${before}... </span> <span class="show-on-hover">${beforeReplacementParagraph}</span> </p> <p class="extraNodeParagraph">${after} </p> ` } return ` <p class="nodeParagraph">${node} </p>` }) 
 .totalWrapper { position: absolute; width: 110%; height: 200%; z-index: 1; } .wrapper { width: 370px; height: auto; position: sticky; left: 152px; top: 200; z-index: 3; } .divname { position: relative; z-index: 1000; } .cropcircle { width: 20px; height: 20px; border-radius: 100%; background: #eee no-repeat center; background-size: cover; } .nodeParagraph { font-size: 14px; letter-spacing: 0.03px; cursor: pointer; font-family: $font-family-base; position: relative; font-weight: 300; z-index: 2; left: 20px; top: 20px; width: 265px; } .nodeParagraph:hover + .extraNodeParagraph { display: block; } .extraNodeParagraph { font-size: 14px; letter-spacing: 0.03px; cursor: pointer; font-family: $font-family-base; position: relative; font-weight: 300; z-index: 2; left: 47.5px; top: 10px; width: 265px; display: none; height: auto; } .nodeParagraph .show-on-hover{ display: none; } .nodeParagraph:hover .hide-on-hover{ display: none; } .nodeParagraph:hover .show-on-hover{ display: block; } .headerDiv { position: relative; z-index: 1001; height: 20px; width: 295px; background: #fff; clear: both; margin-top: 90px; left: 18px; } .headerText { position: relative; color: #1A2F59; left: 13px; top: 5.5px; font-size: 16px; } .headerTextIndividual { position: relative; color: #1A2F59; left: 13px; top: 5.5px; font-size: 16px; } .rightBox { font-family: $font-family-base; z-index: -1; position: absolute; width: 295px; float: left; background:#fff; box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.05); height: auto; -webkit-user-select: none; /* Chrome/Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; padding-bottom: 20px; // overflow: hidden; left: 18px; max-height: 300px; overflow-y: auto; border-style: dotted; } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script> <div id="totalWrapper" class="totalWrapper" (click)="hideBox()"> <div class="wrapper"> <div id="headerDiv"class="headerDiv"> <h1 id="headerText"class="headerText">{{ 'More Engagements' | translate }} </h1> </div> <div id="rightBox" class = "rightBox"> <table > <tr id="titleTable" class="titleTable"> <td><div id="divname" class = "divname"></div></td> </tr> </table> </div> </div> </div> 

My expected result is that even when i have reached the bottom, the box will still expand to allow for the second paragraph, meaning there is no flicker. 我的预期结果是,即使我到达底部,该框仍会扩展以容纳第二段,这意味着没有闪烁。

Hovering on the line of text has no issues but when you mouse touches some areas inside the extended paragraph makes it glitch. 将鼠标悬停在文本行上没有问题,但是当您触摸扩展段落内的某些区域时,它会出现故障。

Fast fix would be adding the css like below 快速修复将添加如下的CSS

.nodeParagraph:hover + .extraNodeParagraph:hover {
  display: block;
}

 node = ["systems development highways junior", "Dale", "efefefefe efef", "dadadadada dadadad adadadadadad", "systems biggest development pot ever in the hands of the most junior fishermen", "systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen","systems biggest development pot ever in the hands of the most junior fishermen", ] d3.selectAll('#titleTable').selectAll('td') .data(node) .enter() .append('divname') .html(node => { if (node && node.length > 35) { var before = node.slice(0, node.indexOf(' ', 28)); var after = node.slice(node.indexOf(' ', 24)); var beforeReplacementParagraph = node.slice(0, node.indexOf(' ', 24)); return ` <p class="nodeParagraph"> <span class="hide-on-hover">${before}... </span> <span class="show-on-hover">${beforeReplacementParagraph}</span> </p> <p class="extraNodeParagraph">${after} </p> ` } return ` <p class="nodeParagraph">${node} </p>` }) 
 .totalWrapper { position: absolute; width: 110%; height: 200%; z-index: 1; } .wrapper { width: 370px; height: auto; position: sticky; left: 152px; top: 200; z-index: 3; } .divname { position: relative; z-index: 1000; } .cropcircle { width: 20px; height: 20px; border-radius: 100%; background: #eee no-repeat center; background-size: cover; } .nodeParagraph { font-size: 14px; letter-spacing: 0.03px; cursor: pointer; font-family: $font-family-base; position: relative; font-weight: 300; z-index: 2; left: 20px; top: 20px; width: 265px; } .nodeParagraph:hover + .extraNodeParagraph { display: block; } .nodeParagraph:hover + .extraNodeParagraph:hover { display: block; } .extraNodeParagraph { font-size: 14px; letter-spacing: 0.03px; cursor: pointer; font-family: $font-family-base; position: relative; font-weight: 300; z-index: 2; left: 47.5px; top: 10px; width: 265px; display: none; height: auto; } .nodeParagraph .show-on-hover{ display: none; } .nodeParagraph:hover .hide-on-hover{ display: none; } .nodeParagraph:hover .show-on-hover{ display: block; } .headerDiv { position: relative; z-index: 1001; height: 20px; width: 295px; background: #fff; clear: both; margin-top: 90px; left: 18px; } .headerText { position: relative; color: #1A2F59; left: 13px; top: 5.5px; font-size: 16px; } .headerTextIndividual { position: relative; color: #1A2F59; left: 13px; top: 5.5px; font-size: 16px; } .rightBox { font-family: $font-family-base; z-index: -1; position: absolute; width: 295px; float: left; background:#fff; box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.05); height: auto; -webkit-user-select: none; /* Chrome/Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; padding-bottom: 20px; // overflow: hidden; left: 18px; max-height: 300px; overflow-y: auto; border-style: dotted; } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script> <div id="totalWrapper" class="totalWrapper" (click)="hideBox()"> <div class="wrapper"> <div id="headerDiv"class="headerDiv"> <h1 id="headerText"class="headerText">{{ 'More Engagements' | translate }} </h1> </div> <div id="rightBox" class = "rightBox"> <table > <tr id="titleTable" class="titleTable"> <td><div id="divname" class = "divname"></div></td> </tr> </table> </div> </div> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM