You need to sign in to do that
Don't have an account?
SF_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; }
Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.
Thanks and Regards