0

I have a button on my website which when clicked, scrolls down to the next section. This works on desktop but not on an ipad or iphone.

I have tried both "touchstart" and "vclick" events. I have tried adding cursor: pointer.

HTML

<div id="icon-div">
 <button id="icon-about" class="raise">LEARN MORE
 <br>
  <i id="arrow" class="fas fa-arrow-down fa-2x"></i>
 </button>
</div>

Javascript


$('#icon-about').bind("click", function(event) {
 event.stopPropagation()
 $('html').stop().animate(
  {scrollTop: $('#about').position().top -20
  }, 500, 'swing');
});

Nothing happens at all with "vclick". cursor:pointer doesn't make a difference.

When I added an alert("") to test "touchstart", the alert box appeared. So I know an event fired but it didn't process the scroll code.

szewah
  • 137
  • 2
  • 15

0 Answers0