본문 바로가기
웹 개발/웹접근성|웹표준

bxslider 웹접근성 대응

by NanaJ 2023. 4. 7.

$('.mainSlider').bxSlider({
	auto: true,
	autoControls: true,
	stopAutoOnClick: true,
	pager: true,
	speed:500,
	autoControlsCombine: true,
	responsive: true,
	pause: 5000,

	// 웹접근성 대응
	onSliderLoad: function(){
		$(".bx-clone").find("a").prop("tabIndex","-1");
	},

	onSlideAfter: function(){
		$(".mainSlider").children("li").each(function(){
			if($(this).attr("aria-hidden") == "false"){
				$(this).find("a").attr("tabIndex","0");
			}else{
				$(this).find("a").attr("tabIndex","-1");
			}

		});

	}

});
반응형

댓글