I'm trying to use @onScroll event but it's not firing at all... I prefer not to use Javascript if it's possible.
<div @onscroll="OnScrollChangeValue" class="sub-header p-10 d-none d-lg-block">
<div class="container">
<div class="row header-wrapper">
<div class="col-lg-6">
</div>
<div class="col-lg-6 text-left">
<div id="cl_switcher_wrapper">
</div>
<div class="dropdown dropdown-store-header dropdown-store-header-left hidden-xs">
<a class="circle-action dropdown-toggle" data-login-link="" href="https://nory.sa/login" rel="nofollow">
<span class="theme-icon-user"></span>
</a>
</div>
</div>
</div>
</div>
</div>
private async Task OnScrollChangeValue(EventArgs e)
{
OnScrollValue = "gg";
}
I understood after MrC aka Shaun Curtis answer that the event must be in the same dev that contains most of the page..but in my case still not working
Updated code
<div @onscroll="OnScrollChangeValue" class="store-home salla-theme_6 color-mode-light font-dinnextltarabic-regular">
<Header></Header>
<h1>@OnScrollValue</h1>
@Body
@code{
public int OnScrollValue { get; set; }
private void OnScrollChangeValue(EventArgs e)
{
OnScrollValue++;
}
}
Updated 1.0
I deleted 99% of the app and the event not firing here the code
<div @onscroll="OnScrollChangeValue" >
<h1>@OnScrollValue</h1>
@Body
i closed the div but it not showing here idk
@code{
public int OnScrollValue { get; set; }
private void OnScrollChangeValue(EventArgs e)
{
OnScrollValue++;
}
}
at the @body only text with one div
Update 2.0
it appears the event firing only inside child div inside the main page..what i mean the main scrollbar for that main page will not fire the event..but if you tried to put div with style overflow:scroll then the event will fire only inside the div which have overflow:scroll...if you tried to put overflow scroll in main div it won't work
style="height:1000px;overflow:scroll" it work with this line of code but i have two scrollbar one on the left and the other on the right