title: Use Javascript to make image go back to original - OpenCart 2.3
body: <p>I wrote some JS that lets me replace the main image on a product page with that a different image. This part is working great. However, I need the original image to return once the mouse leaves. I cannot get this to work.</p>
  
  <p>Also, I would like to add a delay to this so that when I remove the mouse there is like a 1/4 second delay before changing back to the original image. This is all being done on the product page of OC 2.3.</p>
  
  <pre><code>this.imagePreview = function(){ 
  
    $("a.preview").mouseleave(function(e){
      $("#image").attr("src",default_image);         
    });
  
    $("a.preview").hover(function(e){
      $("#image").attr("src",this.rel);         
    });
  
      $(document).ready(function(){
      default_image = $("#image").attr("src");
      imagePreview();
  
  });
  </code></pre>
  
  <p>Can someone help me write this little bit of extra code? Everything else I've tried doesnt work.</p>