Draggable/floating button in blazor

How to create the floating button/floating view(which is draggable to corners) in blazor something like the above button in syncfusion forum that should be available in all webpages or components 
 

1 Reply 1 reply marked as answer

MK Mohan Kumar Ramasamy Syncfusion Team December 7, 2020 01:44 PM UTC

Hi Richy, 
 
We have checked your reported query. We can achieve your requirement using JSInterop. Please refer below code snippets. 
 
 
@using Syncfusion.Blazor.Buttons 
@inject IJSRuntime JSRuntime; 
   
        <SfButton ID="movebutton" Content="Move" CssClass="e-success" Created="Created"></SfButton> 
 
    @code { 
 
        private async Task Created() 
        {   
            await JSRuntime.InvokeVoidAsync("movebutton"); 
        } 
    } 
 
_host.cshtml 
 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <link rel='nofollow' href="_Content/Syncfusion.Blazor/styles/bootstrap4.css" rel="stylesheet" /> 
    <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/ej2-base/styles/material.css" rel="stylesheet"> 
    <script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js" type="text/javascript"></script> 
</head> 
<body> 
     
    <script> 
        function movebutton() { 
            var dragElement = document.getElementById('movebutton'); 
            var draggable = new ej.base.Draggable(dragElement, { clone: false }); 
        } 
    </script> 
</body> 
</html> 
 
For your reference, we have prepared a sample based on this. Please refer below link. 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Mohan kumar R 


Marked as answer
Loader.
Up arrow icon