function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SF_32SF_32 

Cannot read property 'displayBlck' of undefined

I am trying to make the slideshow of images in the lightning component using simple HTML and Javascript but there is an error showing up cannot read property 'style' of undefined. Any help would be appreciated. Here I am loading the images from the parent component.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" controller="images_controller">
     <aura:handler name="init" value="{!this}" action="{! c.doInit }"/>
    <aura:attribute name="selectdImage" type="String" />
    <aura:attribute name="value" type="String" />
   <div class="slideshow-container">
 <div class="slideshow-container slds-scrollable_x">
            <aura:iteration items="{!v.value}" var="row">
     <div class="images" id="msg" style="display: none">
         <img src="{!row.imageURL}" style="width:100%">
         </img>
                </div>
        </aura:iteration>
          </div>
       </div>
</aura:component>
 
({
  doInit: function(component, event, helper) {
    var slideIndex = 0;
    var slides;
    var i;
      var s;
      var p;

    console.log("welcome");
    slides = document.querySelectorAll('.images');
 	    if (slides !== undefined) {
        var displayNone = component.get('c.applyCSSNone');
      for (i = 0; i < slides.length; i++) {
          
        slides[i].displayNone ;
      }

      slideIndex++;
      console.log("entered hereee" + slides);
      if (slideIndex > slides.length) {
        slideIndex = 1;
      }
        var displayBlck = component.get('c.applyCSSBlock');
     slides[slideIndex - 1].displayBlck ;
     setTimeout(doInit, 2000);
    }
  },
    applyCSSNone: function(component, event) {
      var c = component.find("carousel");
      $A.util.addClass(c, 'mySlides');
   },
   applyCSSBlock: function(component, event) {
      var d = component.find("carousel");
      $A.util.addClass(d, 'myImages');
   }
});
 
.THIS .mySlides {
    display:none;
}
.THIS .myImages {
    display:block;
}

 
Danish HodaDanish Hoda
check what is the value you are getting in slideIndex and displayBlck
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
applyCSSBlock  method finding for component with auraid carousel.But there is no component with id as carousel in the markup.Please check that.

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards