Home > Web Front-end > JS Tutorial > Solution to image onload event triggering problem_javascript skills

Solution to image onload event triggering problem_javascript skills

WBOY
Release: 2016-05-16 18:03:56
Original
1318 people have browsed it

And it varies depending on the page size and even the location of the code.

Everything works fine under Firefox.

The solution is to change the value of the image src before onload is triggered, which is equivalent to having a temporary placeholder image at the beginning of the image. During the page loading process, use js to replace it with the actual required src. As long as each If src changes before the onload event is triggered, onload will behave normally.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template