Learn how to use jQuery at the Blog

CSS Layout Generator « visit

  • Added 8 months ago
  • 62 Lines of Code shown
  • 0 Links of Interest
http://csstool.ru
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to CSS Layout Generator - http://csstool.ru

$(function() {

	$('#submit').attr('disabled', true).addClass('inactive');
	$('#set1, #set2').css('background', '#FFFFD5');
	$('#sub1, #sub2').hide().css({position: 'absolute',	top: '22px', left: '145px', padding: '0'});

	$('#set1 input').click(function() {
		$('#set1').css('background', '#FFFFFF');
	});

	$('#set2 input').click(function() {
		$('input[id=eh], input[id=empty]').attr('disabled', false);
		$('label[for=eh], label[for=empty]').css({color: '#444444'});
	});

	$('input[name=sidebar]').click(function() {
		$('#set2').css('background', '#FFFFFF');
	});

	$('input[name=sidebars_number]').click(function() {
		if ( $('input[name=sidebar]:checked').length < 1 ) $('#set2').css('background', '#FFFFD5');
	});

	$('form div input').click(function () {
		$('#preview').removeClass();
		var liq = '';
		if ($('#liq:checked').length > 0) liq = 'liq ';
		if (($('#fix:checked').length > 0 || $('#liq:checked').length > 0) && $('#lc:checked').length > 0) $('#preview').addClass(liq+'ex1');
		if (($('#fix:checked').length > 0 || $('#liq:checked').length > 0) && $('#cr:checked').length > 0) $('#preview').addClass(liq+'ex2');
		if (($('#fix:checked').length > 0 || $('#liq:checked').length > 0) && $('#lcr:checked').length > 0) $('#preview').addClass(liq+'ex3');
		if (($('#fix:checked').length > 0 || $('#liq:checked').length > 0) && $('#lrc:checked').length > 0) $('#preview').addClass(liq+'ex4');
		if (($('#fix:checked').length > 0 || $('#liq:checked').length > 0) && $('#clr:checked').length > 0) $('#preview').addClass(liq+'ex5');
		if (($('#fix:checked').length > 0 || $('#liq:checked').length > 0) && $('#s0:checked').length > 0) $('#preview').removeClass().addClass(liq+'ex6');
		if ($('input[name=width]:checked').length > 0 && ( $('input[name=sidebar]:checked').length > 0 || $('input[id=s0]:checked').length > 0 )) {
			$('#submit').removeAttr('disabled').removeClass('inactive');
		}
	});

	$('label[for=s1]').click(function() {
		$('#sub2').hide();
		$('#sub1').animate({height: 'show'}, 200);
	});

	$('label[for=s2]').click(function() {
		$('#sub1').hide();
		$('#sub2').animate({height: 'show'}, 200);
	});

	$('input[id=s0]').click(function() {
		$('#sub1, #sub2').hide();
		$('#set2').css('background', '#FFFFFF');
		$('input[name=sidebar]').attr('checked', false);
		$('input[id=eh], input[id=empty]').attr('disabled', true).attr('checked', false);
		$('label[for=eh], label[for=empty]').css({color: '#A7A6AA'});
	});

	$('input[name=width], input[name=sidebar], input[id=s0]').click(function() {
		$('#picture').css({opacity: 0});
		$('#picture').animate({opacity: 1});
	});

});