In this example, every time you hover over and out, two images are loaded over the network (should be cached though, after the first tries). And this is expected behaviour. Sometimes it's important to have image element on the page, e.g. for accessibility requirements, but then it's better to show/hide two image elements with css. In most cases it's a bad idea to change image's src attribute with JS, try to use background-image if you can.
In this example, every time you hover over and out, two images are loaded over the network (should be cached though, after the first tries). And this is expected behaviour. Sometimes it's important to have image element on the page, e.g. for accessibility requirements, but then it's better to show/hide two image elements with css. In most cases it's a bad idea to change image's src attribute with JS, try to use background-image if you can.
In this example, every time you hover over and out, two images are loaded over the network (should be cached though, after the first tries). And this is expected behaviour. Sometimes it's important to have image element on the page, e.g. for accessibility requirements, but then it's better to show/hide two image elements with css. In most cases it's a bad idea to change image's src attribute with JS, try to use background-image if you can.