SetOptions of floatingActionButton

3 Answers 17 Views
FloatingActionButton
Alex
Top achievements
Rank 1
Iron
Alex asked on 09 Feb 2022, 10:09 AM

Hi

I use a set of floating action buttons where one of the buttons is used to show / hide the whole button set. As soon as I hide the buttons, this "toggle" button is repositioned to the bottom of the page which works very well by setting the alignOffset value with setOptions.

My problem is now, that the button seems to loose every other css style I've applied directly to the div that becomes the button. Hence I loose the assigned color/background-color and z-index.

Is this a bug or do I miss anything?

Regards

Alex

3 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 14 Feb 2022, 07:36 AM

Hello Alex,

Could you please provide more information about the implementation on your side? I tried to replicate the issue by applying a background to the FloatingActionButton. Then on a button click new values for align and alignOffset properties are set using the setOptions method. However, the FloatingActionButton still has the custom background color. Here you can find the Dojo example I used to test. Could you please let me know if I am missing something?

Could you please try to modify the example in order to replicate the behavior the way it is on your side and send it back? This way we could understand the scenario better and advise you further.

Looking forward to your reply.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Alex
Top achievements
Rank 1
Iron
answered on 14 Feb 2022, 07:42 AM

Hi

thank you for your reply. In fact, that way it works but as soon as you use an inline style like:
<button id="fab-items" style='background-color:#ffccee'></button>

You will see that it changes its color.

Regards

Alex

0
Neli
Telerik team
answered on 17 Feb 2022, 07:01 AM

Hi Alex,

Аs mentioned in the documentation in some cases, the setOptions method can recreate and rebind the widget instance.

In such a scenario where the style is inline, you could use the jQuery CSS method and apply the needed style right after using the setOptions method. 

 $('#fab-items').data('kendoFloatingActionButton').setOptions({
          align: 'middle end',
          alignOffset: { x: 50, y: 50 },
        })
$('#fab-items').css('background-color','#ffccee')

Here is a Dojo example where this approach is demonstrated. 

I hope this helps.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
FloatingActionButton
Asked by
Alex
Top achievements
Rank 1
Iron
Answers by
Neli
Telerik team
Alex
Top achievements
Rank 1
Iron
Share this question
or