Is there a time when it takes a long time to change the path of the image with jquery?

Asked 2 years ago, Updated 2 years ago, 36 views

Is there a time when the delay takes a long time while changing the path of the image with jquery by attr('src','asadsa')? If you keep changing the image path too quickly, you can see that it changes about 0.1 seconds later. I want to know if there is a long delay even if you change it slowly once or twice. if it's long Like .load, I want to specify the behavior after loading an image from the path.

jquery

2022-09-22 18:32

1 Answers

To answer the last question in the comments...

// This is not allowed. The .load() method has been lost since the first time you came to jQuery 3.0.
$('img').atr (blah, blah).load(function(){mumbling});

// This works. Because it just binds the onload event to $('img').
$('img').atr (blah, blah).on('load', function(){mumbling});

Check out demo for actual performance. I hope it was helpful.

+ Interfere: Are you working on "Show Image A until a large image B is loaded and change A to B when it is loaded"? Then study delay loading or seriously consider suggestions for these answers. If additional loading or management is required for loading performance, the code is going wrong somewhere.


2022-09-22 18:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.