I have a piece of code that works on everything except Samsung Internet. Chrome mobile works fine, as do chrome dev tools mobile emulators. I clear the browsing data every attempt.
When a services category button is clicked (first image below), it should open the associated bootstrap collapse card (second image below).
First Image:
Second Image:
Here is the github repo https://github.com/dByler1/windle-chimney https://dbyler1.github.io/windle-chimney/
The .on('click', function(){} part works. Every variable logs cleanly. It just won't go into the logic blocks.
$(".servicesBTN").on("click", function (e) {
//get the data target value of the button that was clicked which is the same as the accordian content IDs
let dataTarget = this.getAttribute("data-target")
let servicesDisplayValue = getComputedStyle(document.getElementById('servicesDescriptions')).display
//all three console.logs fire and log expected results
console.log('data target ' + dataTarget)
console.log('services display value ' + servicesDisplayValue)
console.log('test hasClass' + $(dataTarget).hasClass('show'))
//if the clicked button's associated card does have the show class, set the data toggle to blank so it won't change
//none of the logs in the if blocks fire
if ($(dataTarget).hasClass("show") && servicesDisplayValue === 'block') {
this.setAttribute("data-toggle", "")
console.log('first block - already open - display block')
} else if ($(dataTarget).hasClass("show") && servicesDisplayValue === 'none') {
this.setAttribute("data-toggle", "")
mobileShowServiceInfo($(this))
console.log('second block - already open - display none - mobile assumption')
}
else {
//give the clicked button a data-toggle of collapse so it will open
this.setAttribute("data-toggle", "collapse")
mobileShowServiceInfo($(this))
changeAllAngleIcons($(this))
console.log('third block - ')
}
})