0

I have a fun little button on a website I am developing here:

http://dev.lapiazzaonline.com/merrick.php

When you click on the takeout menu button on desktop and chrome inspector iPhone simulator it works great.... with a nice little delay.

Now on iOS, nothing happens. I think it might have to do with the hover state issue, but more think my JS is messed up.

this is the js in the behavior.js file

// cool buttons
    (function() {
      var removeSuccess;

      removeSuccess = function() {
        return $('.button').removeClass('success');
      };

      $(document).ready(function() {

        return $('.button').click(function(e) {

              e.preventDefault();
              var goTo = this.getAttribute("href"); 

              $(this).addClass('success');
              setTimeout(removeSuccess, 1500);

              setTimeout(function(){
              window.open(goTo);
              },1500); 


        });
      });

    }).call(this);

Any ideas?

Thanks, -Muhu

MuhuPower
  • 404
  • 3
  • 25

1 Answers1

0

Your issue here is the use of window.open. You can read more about this here and other similar issues if you search. Unfortunately, there are multiple reports that jQuery trigger will not work either. So, what I would do is just use something like Modernizr, or if you just want to figure out which browser it is, this is a nice tool, and then when you're on iOS or a browser with similar blocking functionality, run a different function that doesn't prevent the default, and opens the link normally.

Community
  • 1
  • 1
thesublimeobject
  • 1,393
  • 1
  • 17
  • 22