如何检测元素的水平滚动
我在一个包含div的div中从左向右滚动。
我想检测div滚动的时间。
我可以用它来检测窗口滚动,但是如何检测一个元素滚动
@HostListener("window:scroll", []) onWindowScroll() {
console.log('scrolling');
const verticalOffset = window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop || 0;
}
答案 0 :(得分:5)
您可以处理容器div的滚动事件:
foreach (XmlNode node in nodeList)
{
string CustomerName = node.SelectSingleNode("CustomerName").InnerText;
string ReportName = node.SelectSingleNode("ReportName").InnerText + ".pdf";
Outlook.Application mailApplication = new Outlook.Application();
Outlook.MailItem mail = mailApplication.CreateItemFromTemplate(@"d:\Friday Report\#TEMPLATES\template.oft") as Outlook.MailItem;
mail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
mail.Attachments.Add(@"d:\Friday Report\" + ReportName);
mail.Subject = "Application Packaging – Weekly Summary";
CustomerName = "<b>" + CustomerName + "</b> ";
string body = mail.Body;
string new_body = body.Replace("CustomerName", CustomerName );
mail.Body = new_body;
mail.Display(true);
mail.Close(Outlook.OlInspectorClose.olDiscard);
}
<div class="container" (scroll)="onScroll($event)">
<div class="content">
Some content
</div>
</div>
请参阅this stackblitz了解演示。