I have a WordPress Woocomerce site. I have a read more / read less function that expands/hides long product descriptions. It works fine on desktop. It even works using Chrome's mobile emulator tool.
However it does not on any mobile browsers. Pressing the button simply jumps the page up a bit. I'm assuming the browsers aren't reading the .on('click 'touchstart').
:
$(document).ready(function() {
$(".product-readmore").on('click touchstart', function() {
var description = document.querySelector(".product-description-readmore");
if (description.style.height === '') {
description.style.height = 'auto';
} else if (description.style.height === 'auto') {
description.style.height = '';
} else {
description.style.height = '92px';
}
$(this).text($(this).text() == 'Read less...' ? 'Read more...' : 'Read
less...');
});
});