SO - 26486056

HTML

<aside class="refinements" data-hasanyselected="false">
    <h2>REFINE BY</h2>
    <a href="#" class="clear-filter" data-clear="all">Clear All</a>
    <div class="panel" data-id="size" data-hasselections="false">
        <a href="#" class="refinement-header">
            <h3>
                <span class="facet-arrow" data-state="open"></span>
                <span class="facet-name">Size</span>
            </h3>
        </a>
        <a href="#" data-clear="size" class="clear-filter">Clear</a>
        <div class="options scrollable single-column">
            <ul>
                <li>
                    <input type="checkbox" id="size_1878"  />
                    <label for="size_1878">UK 4</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1924"  />
                    <label for="size_1924">UK 6</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1880"  />
                    <label for="size_1880">UK 8</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1944"  />
                    <label for="size_1944">UK 10</label>
                </li>
                <li>
                    <input type="checkbox" id="size_2077"  />
                    <label for="size_2077">UK 12</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1920"  />
                    <label for="size_1920">UK 14</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1992"  />
                    <label for="size_1992">UK 16</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1946"  />
                    <label for="size_1946">UK 18</label>
                </li>
                <li>
                    <input type="checkbox" id="size_1993"  />
                    <label for="size_1993">UK...

CSS

html {
  font-size: 20px;
}
ul, li {
  list-style: none;
  margin:0;
  padding:0;
}

.refinements {
  margin: 0 auto;
  width: 166px;
  position: relative;
}
.refinements a.refinement-header:active, .refinements a.refinement-header:hover, .refinements a.refinement-header:visited {
  color: #000;
}
.refinements h2 {
  border-bottom: 1px solid #999;
  color: #000;
  display: inline-block;
  font-family: Georgia;
  font-size: 1.02em;
  font-weight: normal;
  line-height: 1em;
  margin: 0;
  padding: 6px 0 15px;
  text-transform: uppercase;
  width: 100%;
}
.refinements[data-hasanyselected='False'] a.clear-filter,
.refinements[data-hasanyselected='false'] a.clear-filter {
  display: none;
}
.refinements a.clear-filter {
  color: #666;
  font-size: 0.65rem;
  font-weight: bold;
  position: absolute;
  right: 0;
  text-decoration: none;
  top: 4px;
}
.refinements a.clear-filter:hover {
  text-decoration: underline;
}
.refinements .panel {
  border-bottom: 1px solid #999;
  clear: both;
  padding: 0 0 6px;
  position: relative;
}
.refinements .panel:last-of-type {
  border: none;
}
.refinements .panel a {
  line-height: 0.95em;
  position: relative;
  text-decoration: none;
}
.refinements .panel a h3 {
  line-height: 0.9em;
  margin: 4px 0 1px;
  position: relative;
  text-transform: uppercase;
}
.refinements .panel a h3 span.facet-arrow[data-state='open'] {
  border-color: #666666 rgba(102, 102, 102, 0) rgba(102, 102, 102, 0) rgba(102, 102, 102, 0);
  border-style: solid;
  border-width: 5px;
  height: 0;
  width: 0;
  left: 1px;
  position: absolute;
  top: 10px;
}
.no-rgba .refinements .panel a h3 span.facet-arrow[data-state='open'] {
  border-color: #666666 transparent transparent transparent;
}
.ie7 .refinements .panel a h3 span.facet-arrow[data-state='open'], .ie8 .refinements .panel a h3 span.facet-arrow[data-state='open'] {
  border-width: 5px;
}
.refinements .panel a h3 span.facet-arrow[data-state='closed'] {
  border-color: rgba(102, 102, 102, 0) rgba(102,...

JavaScript

var $clearAll = $('.refinements > .clear-filter'),
    $checks = $('.options input[type="checkbox"]'),
    $clear = $('.refinements .panel .clear-filter');
$checks.change(function () {
    var $options = $(this).closest('.options'),
        $clear = $options.prev();
    //if the current checkbox is checked we can show the all and clear buttons
    if (this.checked) {
        $clear.show();
        $clearAll.show();
    } else {
        //if it is an uncheck operation then set the visibility based on overall state of respective checkboxes
        $clear.toggle($options.find('input[type="checkbox"]').is(':checked'))
        $clearAll.toggle($checks.is(':checked'))
    }
})

$clearAll.click(function (e) {
    e.preventDefault();
    $checks.prop('checked', false);
    $(this).hide();
    $clear.hide();
})
$clear.click(function (e) {
    e.preventDefault();
    $(this).next().find('input[type="checkbox"]').prop('checked', false);
    $clearAll.toggle($checks.is(':checked'));
    $(this).hide();
})