K
K
Konstantin2020-07-19 16:13:56
JavaScript
Konstantin, 2020-07-19 16:13:56

How not to show a slide that is recreated by a script?

I create a functionality in wp that displays or hides blocks using a checker. Everything works correctly with regular blocks, but it does not work with the slick slider, I specify to hide a certain slide, but the slick slider recreates it and, accordingly, the block is still visible. How can I get around this so that after I set it up, it recreates this slide?

The code that disables the display of the slide.

// настройка чекера для слайда 1
  wp.customize( 'checker_slide1', function( value ) {
    value.bind( function( newVal ) {
      //false === newVal ? $( '#slick-slide01' ).hide() : $( '#slick-slide01' ).show();
      if (false === newVal) {
        $('.single-item').removeData('slide1');
         $( '#slick-slide01' ).hide();
         alert('no');
        }
      else {
         alert('yes');
         $( '#slick-slide01' ).show();
      }
    } );
  });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question