Last active
November 18, 2020 04:41
-
-
Save djrmom/7a98b73654c1cd53e189cea681ac371f to your computer and use it in GitHub Desktop.
facetwp cars demo radio buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.facetwp-facet.facetwp-facet-vehicle_type { | |
margin-bottom: 0; | |
} | |
.facetwp-facet-vehicle_type .facetwp-radio { | |
display: inline-block; | |
background: none; | |
line-height: 48px; | |
width: 120px; | |
margin: 0; | |
} | |
.facetwp-facet-vehicle_type .facetwp-radio.checked { | |
background: none; | |
} | |
.facetwp-facet-vehicle_type .facetwp-radio img { | |
opacity: 0.3; | |
vertical-align: top; | |
width: 48px; | |
} | |
.facetwp-facet-vehicle_type .facetwp-radio.checked img { | |
opacity: 1; | |
} | |
</style> | |
<script> | |
(function($) { | |
$(document).on('facetwp-loaded', function() { | |
var $parent = $('.facetwp-facet-vehicle_type'); | |
$parent.find('.facetwp-radio').each(function() { | |
var $this = $(this); | |
var type = $this.attr('data-value'); | |
var counter = $this.find('.facetwp-counter').text().replace('(', '').replace(')', ''); | |
$this.html('<img src="https://facetwp.com/wp-content/themes/fwp/img/icons/cars/' + type + '.svg" alt="' + type + '" /> ' + counter); | |
}); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment