簡體   English   中英

導航欄輪播項目背景顏色

[英]Navbar carousel item background color

我在同一部分中有一個導航欄和輪播,我想要的是當輪播指示器變為活動狀態時,它會更改導航欄和輪播項目​​的背景顏色,有關如何使用jquery函數執行此操作的任何想法? 這是指標的我的jQuery代碼:

  $(document).ready(function(ev){
        $('#carousel-example-generic').on('slide.bs.carousel', function (evt) {
        $('#carousel-example-generic .controls li.active').removeClass('active');    
        $('#carousel-example-generic .controls li:eq('+$(evt.relatedTarget).index()+')').addClass('active');        
            });

像這樣嘗試。使用jQuery,您可以將actions/methods鏈接在一起。 鏈接允許我們在單個語句中運行多個jQuery方法(在同一元素上)。

    $('#carousel-example-generic .controls li:eq('+$(evt.relatedTarget).index()+')').css('background-color','green').addClass('active');   //sets background-color green     

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM