In fade mode, track content is not accessible. Looks like this is intended behavior, but it's buggy also.
Step to reproduce:
Result: Text1 link is overlay by Text2 track and is not clickable
Example https://jsfiddle.net/a2drpgus/3/
Is this the same issue as https://github.com/akiran/react-slick/issues/269?
@zachguo yes, it's the same issue
Similar problems have been fixed in previous releases. Please feel free to request reopen if disagree.
In fade mode, where each slide contains a button or any other element which binds to a click event
I am using the latest version of react-slick and I request to reopen the issue @laveesingh .
Replicate on CodeSandBox
Hi, this is the way I solved the bug.
CSS
// In this way the first slide is
// the clickable one on page load
.slick-slide:first-child {
z-index: 10;
}
JS
// After first slide change, the clickable
// slide is managed by JS
var settings = {
afterChange: function() {
let siblings = document.querySelectorAll(".slick-slide");
let current = document.querySelector(".slick-current");
for(let i = 0; i < siblings.length; i++) {
siblings[i].style.zIndex = 0;
}
current.style.zIndex = 10;
}
};
Hope it helps.
Hi, im having the same issue, when the button is clicked it does not linke to the destination id of the displayed slide. Instead it links to the first slide id.
Here is my code:
const settings = {
infinite: false,
dots: false,
arrows: true,
fade: true,
responsive: [
{
breakpoint: MIN_WIDTH_DESKTOP,
settings: {
arrows: false
}
}
]
};
<Slider {...settings}>
{destinations.map((destination, index) => (
<Destination
destination={destination}
totalDests={destinations.length}
index={index}
key={destination.id}
/>
))}
</Slider>
<Link to={ROUTES.DESTINATION(destination.id)} className="dest-button-cont">
<Button text={STRINGS.EXPLORE} color="light-blue" textColor="white" size="small" />
<img alt="arrow" src={icArrow} className="button-arrow" />
</Link>
Hope it helps to fix this issue.
Check this solution: https://github.com/akiran/react-slick/issues/269#issuecomment-250831665
Yup, after posting this I realized I can achieve the same with pure CSS. Forgot to comment here, thanks for the link.
By the way, only using .slick-active selector worked for me.
Yup, after posting this I realized I can achieve the same with pure CSS. Forgot to comment here, thanks for the link.
By the way, only using
.slick-activeselector worked for me.
Thanks Juan-Rios,
Setting the z-index of the active slide to 10 solved the problem.
Most helpful comment
In fade mode, where each slide contains a button or any other element which binds to a click event
I am using the latest version of react-slick and I request to reopen the issue @laveesingh .
Replicate on CodeSandBox