I'm using MixitUp with the multifilter extension to filter some of the room types in a site I'm developing. The CMS is WordPress so the general integration is easy and was working until introducing custom styled select dropdowns.
I've found a jQuery script that generates custom styled select dropdown lists - this leads me to my issue of having mixitup do it's thing when selecting an option from any of the dropdowns, as the jQuery replicates a div based version of the select menu it no longer works. Even when I try and console.log something I'm not getting anything through.
This is the template part to generate the is as follows:
This is the script for the MixitUp - it's located on the template part itself:
<script>
$(function(){
var containerEl = document.querySelector('#filter-container');
var mixer = mixitup(containerEl, {
controls: {
toggleLogic: 'and'
},
multifilter: {
enable: true
}
});
$('.custom-option').on('click', function() {
var filterString = $('.selection').data('value')
// var filterString = $(this).data('value') have also tried this as well to no avail
console.log(filterString)
mixer.filter(filterString);
});
});
</script>
And this is the script that generates the custom select dropdowns:
So currently when a .custom-option class is clicked on, nothing seems to happen, I've tried creating a single function to handle just logging a string message on click and it just seems to do nothing, once I can somehow pass this value across then I should be find to create the same mixer string that I used before to make the MixitUp section work. My only working theory is that I'm targeting the wrong selector - failing that because my jQuery for the MixitUp is within the template part it's getting loaded before and causing some sort of initialisation issue?
I'm using MixitUp with the multifilter extension to filter some of the room types in a site I'm developing. The CMS is WordPress so the general integration is easy and was working until introducing custom styled select dropdowns.
I've found a jQuery script that generates custom styled select dropdown lists - this leads me to my issue of having mixitup do it's thing when selecting an option from any of the dropdowns, as the jQuery replicates a div based version of the select menu it no longer works. Even when I try and console.log something I'm not getting anything through.
This is the template part to generate the is as follows:
This is the script for the MixitUp - it's located on the template part itself:
And this is the script that generates the custom select dropdowns:
So currently when a .custom-option class is clicked on, nothing seems to happen, I've tried creating a single function to handle just logging a string message on click and it just seems to do nothing, once I can somehow pass this value across then I should be find to create the same mixer string that I used before to make the MixitUp section work. My only working theory is that I'm targeting the wrong selector - failing that because my jQuery for the MixitUp is within the template part it's getting loaded before and causing some sort of initialisation issue?