As part of a custom WordPress loop I have the following line which calls the post thumbnail as a background via inline CSS. I want the background thumbnail to change on hover.
<div style='background-image: url(<?php echo get_the_post_thumbnail_url(); ?>);'>
Tried to do it with mixing answers I found
How to write a:hover in inline CSS?
<div onMouseOut="this.style.background-image='url(<?php echo get_the_post_thumbnail_url(); ?>);'" onMouseOver="this.style.background-image='url(<?php global $product; $attachment_ids = $product->get_gallery_attachment_ids(); echo $image_link = wp_get_attachment_url( $attachment_id ); ?>);'">