0

I am using Kendo UI tabs so once tabs reach the last li list the right navigation arrow get hidden or added the display none inline CSS with jquery so I want to override the display none to display block !important and add opacity 0.4 when div have display none property.

https://dojo.telerik.com/@vishal14/UcaPEYoh

I try with if statement but its not working

<script>
                $(document).ready(function () {
                    $("#tabstrip").kendoTabStrip();
  
                    if($('.k-button').is(':visible')){
                        $(this).css("opacity","0.2");    
                    }else{
                        $(this).css("opacity","1");  
             
                }
                });
            </script>
1
  • There is no $('.k-button') in code shown (or in demo link) and this is the document Commented Aug 13, 2020 at 10:34

1 Answer 1

1

Your code if($('.k-button').is(':visible')) is not working because the left and right buttons are added dynamically.

For the right button, try this code:

$(document).ready(function () {
            $("#tabstrip").kendoTabStrip();
            setInterval(function () {
                var el = $('.k-tabstrip-next');

                if (el.css('display') == 'none') {
                    el.css("opacity", "0.2").css('display', '');
                    el.attr('data-el', 'stop');
                }
                else if (el.attr('data-el') != 'stop')
                    el.css("opacity", "1");
            }, 200);

            $(document).on('click', '.k-tabstrip-prev', function () {
                $('.k-tabstrip-next').attr('data-el', '');
            });
        });

If you want both buttons to be visible, you can try this:

$(document).ready(function () {
            $("#tabstrip").kendoTabStrip();
            setInterval(function () {
                var ne = $('.k-tabstrip-next');
                var pr = $('.k-tabstrip-prev');

                if (ne.css('display') == 'none') {
                    ne.css("opacity", "0.2").css('display', '');
                    ne.attr('data-el', 'stop');
                }
                else if (ne.attr('data-el') != 'stop')
                    ne.css("opacity", "1");

                if (pr.css('display') == 'none') {
                    pr.css("opacity", "0.2").css('display', '');
                    pr.attr('data-el', 'stop');
                }
                else if (pr.attr('data-el') != 'stop')
                    pr.css("opacity", "1");


            }, 200);


            $(document).on('click', '.k-tabstrip-prev', function () {
                $('.k-tabstrip-next').attr('data-el', '');
            });


            $(document).on('click', '.k-tabstrip-next', function () {
                $('.k-tabstrip-prev').attr('data-el', '');
            });
        });
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, perfect answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.