Reputation: 543
var myVideo = document.getElementById('myVideo');
var deviceAgent = navigator.userAgent.toLowerCase();
var event = deviceAgent.match(/(iphone|ipod|ipad)/) ? 'touchstart' : 'click';
$(document).on(event, '.mejs-fullscreen-button', function () {
if (event == 'click') {
//here it cant catch click event
}//end of click
else {
}//end of touchstart
});
how to correctly map here when click or touchstart event starts? if(event=='click') does not work in window browsers any other way to write it?
Upvotes: 0
Views: 109
Reputation: 38112
You need to pass event
to your function as well as using event.type instead:
$(document).on(event, '.mejs-fullscreen-button', function (event) {
if (event.type == 'click') {
//here it cant catch click event
}//end of click
else {
}//end of touchstart
});
Upvotes: 1