So I have an issue with an event firing and doing what its supposed to on desktop but on mobile it won't fire at all. Essentially I have 2 links(Hide & Report). When clicked they send the ids to the Jquery function that sends to php and updates the database. Works on the desktop browsers without issue, but not on mobile. Here is the problematic code:
if(isset($_SESSION['member_session'])){
echo'
<a class="dropdown-toggle pull-right moreForumBtn" id="menu1-'.$row['topic_id'].'" data-toggle="dropdown"><i class="fa fa-ellipsis-v moreSelect"></i></a>
<ul class="dropdown-menu pull-right" style="z-index: 99;"role="menu" aria-labelledby="menu1-'.$row['topic_id'].'">
<li role="presentation"><a class="fullClickLink hideForumTopic" data-hideForumTopicUser-id="'.$row['user_id'].'" data-hideForumTopicID-id="'.$row['topic_id'].'"><i class="fa fa-eye-slash"></i> Hide</a></li>
<li class="divider"></li>
';
if($queryReport->rowCount() > 0){
echo'<li role="presentation"><span style="margin-left:20px;"><i class="fa fa-flag" style="color:#cc0000;"></i> Reported</span></li>';
}else{
echo'
<li role="presentation"><a class="reportUser reportUserMsg" data-rptUser-id="'.$row['user_id'].'" data-msgReport-id="'.$row['topic_id'].'"><i class="fa fa-flag"></i> Report as spam</a></li>
</ul>
';
}
}
Here is the function that sends the data to an AJAX call, this function will not fire on mobile for some reason. Is there a specific way for mobile to handle li and anchor onclicks or something, because I have a ton of click events that all work on mobile. Its just this li/hover click event not working.
$(".hideForumTopic").on("click touchstart", function(){
var userid = $(this).attr("data-hideForumTopicUser-id");
var hideTopic = $(this).attr("data-hideForumTopicID-id");
alert("TEST");
//hideTopicUser(userid, hideTopic);
});
Here is an image of the links for clarity
Appreciate any info. Thanks. Edited with touchstart added but it stil ldoes not fire on my android phone.
Solution: Problem was with the style (z-index) added to the unordered list. once set to z-index:998; it worked.
set with a style z-index:99 which would allow the button to be displayed properly but when clicked it just closed the dropdown. The click function had been working properly.
– Stuckfornow Dec 29 '19 at 22:48