0

In a WordPress page I have added a short script in order to display a loading icon when a user clicks some links of the page.

The below implementation works everywhere, except in Apple devices (in Safari). Any hint, how can I fix this?

$('.load-icon .zoom_box  a').on('click', function() {
  $('.my-hide').css("display", "block");
});
.loading {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.02);
}

.loading-wheel {
  width: 20px;
  height: 20px;
  margin-top: -40px;
  margin-left: -40px;
  position: absolute;
  top: 50%;
  left: 50%;
  border-width: 30px;
  border-radius: 50%;
  -webkit-animation: spin 1s linear infinite;
}

.style-2 .loading-wheel {
  border-style: double;
  border-color: #74AFAD transparent;
}

@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}

.my-hide{
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="load-icon">
  <div class="zoom_box">
    <a href="#">link</a>
  </div>
</div>

<div class="loading style-2 my-hide">
    <div class="loading-wheel"></div>
</div>
yaylitzis
  • 5,354
  • 17
  • 62
  • 107
  • Purely a shot in the dark - have you tried removing the console.log, or at least placing it under the other statement? I know some browsers (thinking IE here) need specific window.console... – asimovwasright Feb 05 '18 at 12:20
  • the `console.log` doesn't concerns me (I added it there, just to be sure that I catch the click) .. The fact that the loading icon doesn't appear is the matter here.. – yaylitzis Feb 05 '18 at 12:23
  • Yes, but if a statement fails in the block, the rest of the block is not executed. Could also be a similar bug to this: https://stackoverflow.com/questions/26108326/fixed-position-not-working-in-safari-7 – asimovwasright Feb 05 '18 at 12:24
  • You have a point and I tried it (I remove that line). However, it's still not appearing.. – yaylitzis Feb 05 '18 at 12:27
  • Can you see anything in the dev tools of safari - is the element misplaced or not there at all? – asimovwasright Feb 05 '18 at 12:28

0 Answers0