2

I'm using the following bit of code that seems to be working fine on all the desktop browsers I've checked, but chokes on mobile Safari and Chrome. Does anyone with more jQuery experience see any reason why that might be happening?

$(document).ready(function() {

    $("#Menu a").click(function(event){
        event.preventDefault();
        var linkLocation = this.href;
        $(".Content").animate({marginTop: "1000px"}, '500', function(){
            $(".Content").load(linkLocation, function(){
                $(".Content").animate({marginTop: "0px"}, '500');
            });
        }); 


    });

});

Thanks for any help!

Smandoli
  • 6,919
  • 3
  • 49
  • 83
stupendousman
  • 93
  • 2
  • 9
  • 2
    Have you tried using `$(this)` instead of just `this` ? Just an idea... – jtheman Jun 28 '13 at 12:13
  • 2
    ya because $(this).attr('href') and this.href don't return same value, this.href return absolute path, not value of attribute href but should be the same on all browsers i think – A. Wolff Jun 28 '13 at 12:16
  • 1
    `mouseleave` on a phone? You did not tell us what's not working. – a better oliver Jun 28 '13 at 12:24
  • I've edited my code to reflect what seems to be the problem. mouseleave is in reference to another bit of code not shown. I'll try the other suggestions and report back. Thanks! – stupendousman Jun 28 '13 at 16:04

1 Answers1

1

I think I found an answer. Looks like changing

$("#Menu a").click(function(event){});

to

 $("#Menu a").on('click touchstart', (function(event){});

seems to clear it up.

Check out the thread here.

Community
  • 1
  • 1
stupendousman
  • 93
  • 2
  • 9