JS popup is not working on Safari (hide/show)

老子叫甜甜 提交于 2021-01-29 07:44:11

问题


Simple popup with js is not working on IPhone and IPad

Tried to replace href="javascript:PopUpShow()" to onclick="PopUpShow()", but still the same, it works everywhere but Safari

<a href="javascript:PopUpShow()" id="pop-show">click me</a>
<div onclick="PopUpShow()"><i class="fas fa-phone"></i> </div>
<div class="b-popup" id="popup1">
<div class="b-popup-content">
<a class="b-popup-close" href="javascript:PopUpHide()">
<div class="col-md-4 col-12 padding-pop">  <div class="right-cont-pop" id="pop-hide"> close </a></div></div>
<div class="row">
<div class="col-md-4 col-12 padding-pop"><i class="fas fa-phone"></i></div>
<div class="col-md-4 col-12 padding-pop"><i class="fas fa-phone"></i></div>
<div class="padding-pop-text">blabla i'm pop up</div>
</div>
</div>
</div>

This is my JS code

function PopUpShow(){
$("#popup1").show();
}
function PopUpHide(){
$("#popup1").hide();
 }

And css

.b-popup .b-popup-content a{
color: #000;
font-weight: 500;}


.mobil-icons {
display: block;
right: 0px;
position: absolute;
z-index: 999;
padding-top: 10px;}


.b-popup{
display: none;
min-height: 100%;
overflow: hidden;
position: fixed;
top: 0px;}

.b-popup .b-popup-content{
margin: 38px auto 0px auto;
width: 250px;
height: 250px;
padding: 10px;
background-color: #fff;
position: fixed;
top: 0;
right: 0;}

.b-popup-close {
color: #000;
font-weight: 500;
text-decoration: none;}

Please, help me to resolve this problem!


回答1:


As it appears, the problem was not in JS at all. "display: flex;" made the whole popup absolutely invisible. I mean the popup was there the whole time, I tapped at the link on it! Just changed it to "block" and it appeared. But I have a question to Safari developers... WTF?



来源:https://stackoverflow.com/questions/54127433/js-popup-is-not-working-on-safari-hide-show

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!