This is the code I have and it is not working. I dunno how to declare this
var input = {
container: '.slide_container',
container_all: '.slide_show',
slides: []
};
var $slides = $('.slide_show .slide');
var l = $slides.length;
for( var i = 0; i < l; i++ ) {
input.slides[i].el = '#' + $slides.eq(i).attr('id');
if( i === 0 ) {
input.slides[i].weight = 1;
} else {
input.slides[i].weight = 0;
}
}
When it gets to
input.slides[i].el = '#' + $slides.eq(i).attr('id');
it says the input.slides[i].el is undefined. Can someone let me know the correct way to declare the empty slides?
You need to create your object first. Something like:
You also might want to consider using
pushto add to your array.