Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <form>
	<div class="filter"> <span class="filter_label">雇用形態:</span>
		<label>
			<input type="radio" name="types" value="" checked="checked">
			全部</label>
		<label>
			<input type="radio" name="types" value="正社員">
			正社員</label>
		<label>
			<input type="radio" name="types" value="アルバイト">
			アルバイト </label>
	</div>
	<div class="filter"> <span class="filter_label">職種:</span>
		<label>
			<input type="checkbox" name="works" value="営業職">
			営業職</label>
		<label>
			<input type="checkbox" name="works" value="事務職">
			事務職</label>
		<label>
			<input type="checkbox" name="works" value="現場職">
			現場職</label>
	</div>
</form>
<ul class="list">
	<li class="item" data-types="正社員" data-works="営業職">【正社員】営業職</li>
	<li class="item" data-types="正社員" data-works="現場職">【正社員】現場職</li>
	<li class="item" data-types="正社員" data-works="事務職">【正社員】事務職</li>
	<li class="item" data-types="アルバイト" data-works="営業職">【アルバイト】営業職</li>
	<li class="item" data-types="正社員" data-works="事務職">【正社員】事務職</li>
	<li class="item" data-types="アルバイト" data-works="事務職">【アルバイト】事務職</li>
	<li class="item" data-types="アルバイト" data-works="現場職">【アルバイト】現場職</li>
	<li class="item" data-types="正社員" data-works="事務職">【正社員】事務職</li>
	<li class="item" data-types="アルバイト" data-works="営業職">【アルバイト】営業職</li>
	<li class="item" data-types="アルバイト" data-works="現場職">【アルバイト 色:現場職 </li>
</ul>
              
            
!

CSS

              
                .filter_label {
    font-weight: bold;
}
.hidden {
    display: none!important;
}

.list{
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;

	li{
		flex: 0 0 25%;
		max-width: 25%;
		border: 2px solid #ddd;
		display: block;
		padding: 1em;
		margin: 2px;
	}
	li[data-types="正社員"]{
		background: skyblue;
	}
	li[data-types="アルバイト"]{
		background: pink;
	}
}
              
            
!

JS

              
                var Filters = '.filter';
var Item = '.item';
var classHidden = 'hidden';

$(function () {

	// 絞り込み項目を変更した時
	$(document).on('change', Filters + ' input', function () {
		SearchFilters();
	});

	if ("#seisha" == location.hash) {
		//URLハッシュが#seishaの場合正社員にチェック
		$('.filter input[value="正社員"]').prop("checked", true);
		SearchFilters();
	} else if ("#alb" == location.hash) {
		//URLハッシュが#albの場合正社員にチェック
		$('.filter input[value="アルバイト"]').prop("checked", true);
		SearchFilters();
	}
});


//リストの絞り込み
function SearchFilters() {
	// 非表示を解除
	$(Item).removeClass(classHidden);
	for (var i = 0; i < $(Filters).length; i++) {
		var name = $(Filters).eq(i).find('input').attr('name');
		// 選択されている項目を取得
		var searchData = SelectItems(name);
		// 選択項目がない、またはALLの場合
		if (searchData.length === 0 || searchData[0] === '') {
			continue;
		}
		// リスト内のアイテムをチェック
		for (var j = 0; j < $(Item).length; j++) {
			// アイテム設定している項目を取得
			var itemData = $(Item).eq(j).data(name);
			// 絞り込み対象かどうかをチェック
			if (searchData.indexOf(itemData) === -1) {
				$(Item).eq(j).addClass(classHidden);
			}
		}
	}
}

//選択された値の一覧を取得
function SelectItems(name) {
	var searchData = [];
	$('[name=' + name + ']:checked').each(function () {
		searchData.push($(this).val());
	});
	return searchData;
}

              
            
!
999px

Console