Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery查找活动元素和接下来的3个元素_Jquery_Swiper - Fatal编程技术网

使用jquery查找活动元素和接下来的3个元素

使用jquery查找活动元素和接下来的3个元素,jquery,swiper,Jquery,Swiper,我正在尝试使用jquery查找活动幻灯片(类名=swiper slide active),然后包含接下来的3个元素,在它们上面添加一些CSS代码 HTML: 但它不起作用,我也试过: $('.swiper-slide-active').slice(0,3).css({opacity:.5}); 任何帮助都将不胜感激 您需要使用并应用.slice(0,3)。 $('.swiper-slide-active').nextAll().slice(0,3).css({ 不透明度:.5 }); ##使

我正在尝试使用jquery查找活动幻灯片(类名=swiper slide active),然后包含接下来的3个元素,在它们上面添加一些CSS代码

HTML:

但它不起作用,我也试过:

$('.swiper-slide-active').slice(0,3).css({opacity:.5});
任何帮助都将不胜感激

您需要使用并应用
.slice(0,3
)。
$('.swiper-slide-active').nextAll().slice(0,3).css({
不透明度:.5
});

##使用jquery查找此类
##这个呢
##这个呢
##这个呢
##
##
##
##
##
##
$('.swiper-slide-active').css({opacity:.5}).next('.swiper-slide:lt(3)').css({opacity:.5});
$('.swiper-slide-active').slice(0,3).css({opacity:.5});