Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Нужна помощь (https://javascript.ru/forum/misc/45688-nuzhna-pomoshh.html)

Romantik 12.03.2014 11:00

Нужна помощь
 
$(function () {
	$('#confTable div.button').click(function() {
		$(this).toggleClass('selected');
		var checkElement = $(this).next();
		var queryId = checkElement.find('div').attr('id');
		
		confCaros = new Array();
		confCaros[queryId] = new Carousel(queryId);
		confCaros[queryId].itm_height = -20;
		confCaros[queryId].width = 100;
		confCaros[queryId].format = function(arg) { 
			if ( arg ) return "<div class='goodsItem'> "+"<img src='"+"/tn"+arg.mattex+"' class='gridImg' "+
			"alt='' title='"+arg.matgname+" ("+arg.matgcode+")\n"+arg.umat+(arg.size?"\n3D-данные: размер - "+arg.size+"Mb":"")+
			"'><br/>"+"<span>"+arg.matgname+" ("+arg.matgcode+") "+arg.umat+"</span><br/>";  
			return ""; 
		}
		confCaros[queryId].id = queryId;
		confCaros[queryId].url = "/mat";
		confCaros[queryId].query = {abs:abstract_id,start:0,count:5};
		confCaros[queryId].startup();
		
		checkElement.stop().animate({'height':'toggle'}, 300);	
		if((checkElement.is('div.carusel')) && (checkElement.is(':visible'))) {
			return false;
		}
	});
});




Как создавать экземпляр класса через массив?? Нужно создавать новую карусель при клике на элемент. В queryId заносится id блока в который нужно вывести карусель. Дело в том что кликабельных полей много на странице и столько же может быть каруселей. И нужно чтобы карусели не дублировались, а создавались новые


Часовой пояс GMT +3, время: 21:40.