javascript - What might make click events slow to fire? - Stack Overflow

For some reason, click events on my live server take significantly longer to fire than on my local deve

For some reason, click events on my live server take significantly longer to fire than on my local development machine. For example, here's some basic code I used as a test:

jQuery(document).ready(function(){
    jQuery('a[rel^="foxyLightbox"]').on("click", function(e) {
        console.log("HA!");
        return false;
    });
});

When I run that locally and click on links, the text prints out to the console pretty much instantaneously. If I click it a bunch of times in a row, there's no lag whatsoever.

When I run it on my live server, there's almost exactly a one second delay before the event fires. If I click it a bunch of times in a row, then there is lag and it prints out about once a second.

Here's a live example page:

The link that triggers the event is the large product image in the upper right.

At first I thought the issue was my javascript code, but then I mented it out and used the test code above (which is extremely short), so that can't be it. What could be delaying the click event from firing?

For some reason, click events on my live server take significantly longer to fire than on my local development machine. For example, here's some basic code I used as a test:

jQuery(document).ready(function(){
    jQuery('a[rel^="foxyLightbox"]').on("click", function(e) {
        console.log("HA!");
        return false;
    });
});

When I run that locally and click on links, the text prints out to the console pretty much instantaneously. If I click it a bunch of times in a row, there's no lag whatsoever.

When I run it on my live server, there's almost exactly a one second delay before the event fires. If I click it a bunch of times in a row, then there is lag and it prints out about once a second.

Here's a live example page: https://www.foxytronics./products/68-springrc-sm-s4303r-continuous-rotation-servo

The link that triggers the event is the large product image in the upper right.

At first I thought the issue was my javascript code, but then I mented it out and used the test code above (which is extremely short), so that can't be it. What could be delaying the click event from firing?

Share Improve this question edited Dec 13, 2013 at 1:52 Nate asked Dec 13, 2013 at 1:45 NateNate 28.6k39 gold badges136 silver badges228 bronze badges 2
  • @C.S. My bad, the large picture. If you open your console and then click it, you'll see that there's about a one second delay between the click and the text printing out. Then if you click multiple times, there's a delay between each time it prints out. – Nate Commented Dec 13, 2013 at 1:51
  • When you test locally, did you test only the html file that uses that script, like having an html page with only the thumbnail and the js? or did you test it as it would appear on the website, pleted, but just locally? – C. S. Commented Dec 13, 2013 at 1:59
Add a ment  | 

1 Answer 1

Reset to default 5

I used chrome dev tools and I see that you have strange long mouseDown event handler:

Some work is performed in JS script from static.getclicky.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744218728a4563677.html

相关推荐

  • javascript - What might make click events slow to fire? - Stack Overflow

    For some reason, click events on my live server take significantly longer to fire than on my local deve

    9天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信