Last active
October 2, 2023 21:03
-
-
Save memetican/79a4e587c90106715dc6a4adcb5711c5 to your computer and use it in GitHub Desktop.
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
<script> | |
window.fsAttributes = window.fsAttributes || []; | |
// Apply the initial input counter value as filter state | |
window.fsAttributes.push([ | |
'cmsfilter', | |
(filterInstances) => { | |
console.log('cmsfilter Successfully loaded!'); | |
const counterButtons = document.querySelectorAll('.fs_inputcounter-1_button'); | |
const counterValue = document.querySelector('.fs_inputcounter-1_input'); | |
counterValue.dispatchEvent(new Event('input', { bubbles: true })); | |
counterButtons.forEach((button) => { | |
button.addEventListener('click', () => { | |
counterValue.dispatchEvent(new Event('input', { bubbles: true })); | |
}); | |
}); | |
}, | |
]); | |
// Handle filter updates on increment / decrement | |
window.fsAttributes.push([ | |
'inputcounter', | |
(counterInstances) => { | |
console.log('inputcounter Successfully loaded!'); | |
const counterButtons = document.querySelectorAll('.fs_inputcounter-1_button'); | |
const counterValue = document.querySelector('.fs_inputcounter-1_input'); | |
counterButtons.forEach((button) => { | |
button.addEventListener('click', () => { | |
counterValue.dispatchEvent(new Event('input', { bubbles: true })); | |
}); | |
}); | |
}, | |
]); | |
</script> |
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
<script> | |
window.fsAttributes = window.fsAttributes || []; | |
window.fsAttributes.push([ | |
'inputcounter', | |
(counterInstances) => { | |
console.log('inputcounter Successfully loaded!'); | |
// your code here | |
}, | |
]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment