Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot to trigger animation in code behind before hiding componetns #13

Open
adopilot opened this issue Aug 28, 2020 · 0 comments
Open

Hot to trigger animation in code behind before hiding componetns #13

adopilot opened this issue Aug 28, 2020 · 0 comments

Comments

@adopilot
Copy link

Hay thanks for your effort, it is very nice component.
Can we trigger animation in code behind.
I saw sample which re-render new components.
But much simpler would be to trigger animation from code behind.
What I am trying to do is to animate component before i hide them
I am trying to implement some kid of toggle button on main page
Button should animate fade out menu before hide them and vice versa.
Here is sample code for animating menu on showing this works pretty nice.
My problem is, I do not know how to animate nav component before I hide id.

Here is sample of MainLayout.razor

@inherits LayoutComponentBase
@using BlazorAnimate
@if (DisplayMenu)
{
    <Animate Animation="Animations.FadeRight"   DurationMs="300"  DelayMs="200">
        <div class="sidebar">
            <NavMenu />
        </div>
    </Animate>
}
<div class="main">
    <div class="top-row px-4">
        <button @onclick="ShowHideMenu">Show / hide</button>
    </div>
    <div class="content px-4">
        @Body
    </div>
</div>
@code {
    private bool DisplayMenu = true;
    private void ShowHideMenu()
        {
            DisplayMenu = !DisplayMenu;
            StateHasChanged();
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant