I have several images:
<img class="photo" src="{{ img.url_small }} />
<img class="photo" src="{{ img.url_small }} />
<img class="photo" src="{{ img.url_small }} />
I'm trying to change the border color when the user hovers over the image or clicks on it:
$(".photo").click(function() {
   $(".photo").css({"background":"white"});
   $(this).css({"background":"blue"});
});
$(".photo").mouseenter(function() {
   $(this).css({"background":"green"});
}).mouseleave(function() {
   $(this).css({"background":"white"});
});
(there is a white margin around each image thus that a change in background changes the border)
The trouble is when a user clicks on an image, it turns blue, but then when the mouse is moved from the image, the border turns white.
I tried some conditionals:
$(".photo").mouseenter(function() {
   if($(this).css("background") != "blue") {
      $(this).css({"background":"green"});
   }
}).mouseleave(function() {
   if($(this).css("background") != "blue") {
      $(this).css({"background":"white"});
   }
});
but the borders still turned back white from blue. How can I keep the border blue? Is there a more efficient way of doing this?