Error ID: -270960303 This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'style' of null] Failing descriptor: {c:CommunityBreakingNews}
Controller:
({
doInit : function(component, event, helper) {
//var lWidth = window.innerWidth ;
var lWidth = 400;
window.setInterval($A.getCallback(function() {
helper.handleScroll(component, event,lWidth);
} ), 20);
}
})
Helper:
({
handleScroll: function(component, event,lWidth) {
var changeposition = component.get("v.scrollInterval");
var floatElement = document.getElementById('toScroll');
if(changeposition < lWidth){
floatElement.style.left = changeposition+'px';
changeposition = changeposition + 1;
component.set("v.scrollInterval",changeposition);
}
else{
component.set("v.scrollInterval",0);
floatElement.style.left = "0px";
changeposition = component.get("v.scrollInterval");
}
}
})
Style:
.THIS#scrollDIV{
border: 5px solid;
border-radius: 6px;
background: beige;
height: 50px;
margin: 5px;
padding: 2px;
}