Skip to content

Commit 2fa5764

Browse files
committed
Scroll Move Added.
1 parent 03ac45d commit 2fa5764

20 files changed

+1782
-34
lines changed

samples/blazor-sample/Pages/ScrollbarController.razor

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@inject IBlazorScrollController BlazorScrollController
44

5-
<div style="width: 2000px; height: 2000px;">
5+
<div id="test" class="test" style="width: 2000px; height: 2000px;">
66
<button class="btn btn-danger" @onclick="HideScrollVertical">Hide Scroll Vertical</button>
77
<button class="btn btn-primary" @onclick="ShowScrollVertical">Show Scroll Vertical</button>
88

@@ -11,6 +11,10 @@
1111

1212
<button class="btn btn-danger" @onclick="HideScrollBoth">Hide Scroll Both</button>
1313
<button class="btn btn-primary" @onclick="ShowScrollBoth">Show Scroll Both</button>
14+
15+
<button class="btn btn-primary" @onclick="ScrollToTop" style="position: fixed">Scroll To Top</button>
16+
<button class="btn btn-primary" @onclick="ScrollToBottom" style="position: fixed;top: 120px;">Scroll To Bottom</button>
17+
1418
</div>
1519

1620
@code
@@ -44,4 +48,14 @@
4448
{
4549
await BlazorScrollController.ShowBodyScrollOverflowAsync(ScrollType.Both);
4650
}
51+
52+
private async Task ScrollToTop()
53+
{
54+
await BlazorScrollController.ScrollToBodyTopAsync(ScrollBehaviors.Auto);
55+
}
56+
57+
private async Task ScrollToBottom()
58+
{
59+
await BlazorScrollController.ScrollToBodyBottomAsync( ScrollBehaviors.Auto);
60+
}
4761
}

src/ShadyNagy.Blazor.JavaScriptUtilities/Constants/JSInteropConstants.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ internal static class ScrollController
1818
internal static string ShowScrollOverflowByTag => "showScrollOverflowByTag";
1919
internal static string HideScrollOverflowByClass => "hideScrollOverflowByClass";
2020
internal static string ShowScrollOverflowByClass => "showScrollOverflowByClass";
21+
internal static string ScrollTo => "mainScrollTo";
22+
internal static string ScrollVToElementById => "scrollVToElementById";
23+
internal static string ScrollVToElementByTag => "scrollVToElementByTag";
24+
internal static string ScrollVToElementByClass => "scrollVToElementByClass";
25+
internal static string ScrollHToElementById => "scrollHToElementById";
26+
internal static string ScrollHToElementByTag => "scrollHToElementByTag";
27+
internal static string ScrollHToElementByClass => "scrollHToElementByClass";
28+
internal static string ScrollElementToByTagName => "scrollElementToByTagName";
29+
internal static string ScrollElementToByElementId => "scrollElementToByElementId";
30+
internal static string ScrollElementToByClassName => "scrollElementToByClassName";
31+
internal static string GetScrollHeightByElementId => "getScrollHeightByElementId";
32+
internal static string GetScrollHeightByTagName => "getScrollHeightByTagName";
33+
internal static string GetScrollHeightByClassName => "getScrollHeightByClassName";
34+
internal static string GetScrollWidthByElementId => "getScrollWidthByElementId";
35+
internal static string GetScrollWidthByTagName => "getScrollWidthByTagName";
36+
internal static string GetScrollWidthByClassName => "getScrollWidthByClassName";
37+
internal static string GetScrollLeftByElementId => "getScrollLeftByElementId";
38+
internal static string GetScrollLeftByTagName => "getScrollLeftByTagName";
39+
internal static string GetScrollLeftByClassName => "getScrollLeftByClassName";
40+
internal static string GetScrollTopByElementId => "getScrollTopByElementId";
41+
internal static string GetScrollTopByTagName => "getScrollTopByTagName";
42+
internal static string GetScrollTopByClassName => "getScrollTopByClassName";
43+
internal static string SetScrollLeftByElementId => "setScrollLeftByElementId";
44+
internal static string SetScrollLeftByTagName => "setScrollLeftByTagName";
45+
internal static string SetScrollLeftByClassName => "setScrollLeftByClassName";
46+
internal static string SetScrollTopByElementId => "setScrollTopByElementId";
47+
internal static string SetScrollTopByTagName => "setScrollTopByTagName";
48+
internal static string SetScrollTopByClassName => "setScrollTopByClassName";
2149
}
2250

2351
internal static class Storage

0 commit comments

Comments
 (0)