[英]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.