Home Downloads PropertySelector – jQuery 商品属性选择器插件

PropertySelector – jQuery 商品属性选择器插件

动态加载子属性 + 多组属性 + 单个属性只能选一个子属性

	var mainCategorySelector = function(){
		$.PropertySelector.select({
			titles: $("#property-main h3"),
			lists: $("#property-main ul"),
			onlyone: true
		});
	}, subCategorySelector = function(){
		$.PropertySelector.select({
			titles: $("#property-second h3"),
			lists: $("#property-second ul"),
			onlyone: true
		});
	}, propertySelector = function(){
		$.PropertySelector.select({
			titles: $("#property-third h3"),
			lists: $("#property-third ul")
		});
	}, mainTabView = function(){
		$.ajaxTabView($('#property-main li'), $('#property-second')[0], function(){
			var selectedSubCategory = $('#selected-sub-category')[0], selecedProperty = $('#selected-property')[0], values = $.PropertySelector.getSelectedValues();
			
			subCategorySelector();
			subTabView();
			
			if (selectedSubCategory) {
				$(selectedSubCategory).remove();
				
				if (values['sub-category'].length > 0) {
					values['sub-category'].length = 0;
				}
				
				$('#property-third').html('');
			}
			
			if (selecedProperty) {
				$(selecedProperty).remove();
				
				if (values['property'].length > 0) {
					values['property'].length = 0;
				}
			}
		});
	}, subTabView = function(){
		$.ajaxTabView($('#property-second li'), $('#property-third')[0], function(){
			var selecedProperty = $('#selected-property')[0], values = $.PropertySelector.getSelectedValues();
			if (selecedProperty) {
				$(selecedProperty).remove();
				
				if (values['property'].length > 0) {
					values['property'].length = 0;
				}
			}
			propertySelector();
		});
	};
	
	mainTabView();
	subTabView();
	mainCategorySelector();
	
	$('#save-selected').click(function(){
		var savedValueToUrl = $.PropertySelector.getSelectedValuesToURL();
		alert(savedValueToUrl);
	});
	
	$('#save-selected').click(function(){
		var savedValueToUrl = $.PropertySelector.getSelectedValuesToURL();
		alert(savedValueToUrl);
	});

下载地址:PropertySelector.zip

Facebook Twitter Delicious 开心网 人人网 豆瓣网 新浪微博 网易微博 腾讯微博