react-slick icon indicating copy to clipboard operation
react-slick copied to clipboard

Slide's links are not clickable in fade mode

Open phamviet opened this issue 9 years ago • 10 comments

In fade mode, track content is not accessible. Looks like this is intended behavior, but it's buggy also.

Step to reproduce:

  1. Click Next
  2. Click back

Result: Text1 link is overlay by Text2 track and is not clickable

Example https://jsfiddle.net/a2drpgus/3/

phamviet avatar Aug 31 '17 09:08 phamviet

#853 pull request with the fix

costagolub avatar Sep 08 '17 08:09 costagolub

Is this the same issue as https://github.com/akiran/react-slick/issues/269?

zachguo avatar Oct 02 '17 19:10 zachguo

@zachguo yes, it's the same issue

costagolub avatar Oct 02 '17 21:10 costagolub

Similar problems have been fixed in previous releases. Please feel free to request reopen if disagree.

laveesingh avatar Mar 29 '18 07:03 laveesingh

In fade mode, where each slide contains a button or any other element which binds to a click event

  1. Only the last slide is clickable
  2. Clicking on other slides invokes the click of last slide

I am using the latest version of react-slick and I request to reopen the issue @laveesingh .

Replicate on CodeSandBox

theliveseven avatar Jun 14 '18 07:06 theliveseven

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.

riosjuanig avatar Aug 24 '18 19:08 riosjuanig

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:

  • Settings
const settings = {
    infinite: false,
    dots: false,
    arrows: true,
    fade: true,
    responsive: [
      {
        breakpoint: MIN_WIDTH_DESKTOP,
        settings: {
          arrows: false
        }
      }
    ]
  };
  • Slider
<Slider {...settings}>
    {destinations.map((destination, index) => (
       <Destination
            destination={destination}
            totalDests={destinations.length}
            index={index}
            key={destination.id}
     />
     ))}
</Slider>

  • Slider Child
 <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.

franguerini avatar Sep 12 '18 13:09 franguerini

Check this solution: https://github.com/akiran/react-slick/issues/269#issuecomment-250831665

zhe avatar Sep 16 '18 07:09 zhe

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.

riosjuanig avatar Sep 16 '18 14:09 riosjuanig

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.

Thanks Juan-Rios, Setting the z-index of the active slide to 10 solved the problem.

afiaudofia avatar Nov 06 '19 08:11 afiaudofia