0

So, i have the following jquery:

jQuery('.button').click(function(e) {
            var isMobiles = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false;                  
            if(!isMobiles) {
                jQuery('.button').featherlight(); //lightbox function   
                alert("desktop");                   
            }else{
                alert("mobile");
            }   
        })

In desktop view, I get an alert "Desktop" and featherlight lightbox.

In mobile view, I am still getting the featherlight lightbox and alert "mobile".

I am really confused to why the lightbox function still loads in mobile view when I get "mobile" alert?

Any suggestions?

Steve Kim
  • 5,293
  • 16
  • 54
  • 99

1 Answers1

1

The code you posted is definetly not doing that.

Try this:

  1. Write ​$._data( $('.button')[0], "events" ); on your console to see the events attached to that element.
    We take the first .button, because they should all have the same events attached
  2. Check the response, search for any events calling .featherlight()
Aramil Rey
  • 3,387
  • 1
  • 19
  • 30