I am attempting to trigger a click via jQuery while targeting a data elements. The trigger click works perfectly fine on desktop devices, however on touch devices it's failing. I was doing some reading here: jquery touchstart in browser and attempted to bind a touchstart event, but it's still not working, below is my code with and without the touchstart event.
//basic implementation that works on non-touch devices
$('.mobile-link').click(function() {
$("[data-slidr-breadcrumbs='platforms']").trigger('click');
});
//with touchstart
var clickEventType = ((document.ontouchstart!==null)?'click':'touchstart');
$('.mobile-link').click(function() {
$([data-slidr-breadcrumbs='platforms']).trigger(clickEventType);
});