I have a CSS code that uses 8 images to create a frame:
background-image: url(images/blue/tl.png), url(images/blue/tr.png), url(images/blue/bl.png), url(images/blue/br.png), url(images/blue/t.png),url(images/blue/b.png),url(images/blue/l.png),url(images/blue/r.png);
background-position: top left, right top, bottom left, bottom right, top, bottom, left,right;
background-repeat: no-repeat,no-repeat,no-repeat,no-repeat,repeat-x,repeat-x,repeat-y,repeat-y;
I am trying to create a JQuery program that can dynamically change these image sources. However, I am facing an issue with defining multiple background image changes in JQuery as only one image ends up changing.
Here is the problematic JQuery code:
$(document).ready(function() {
$("#red").on("click", function(){
$("#outer-frame").css({'background-image': "url(images/red/tl.png)", 'background-image': "url(images/red/tr.png)"});
$("#outer-frame").css({'background-position': "top left", 'background-image': "top right"});
});
If anyone has knowledge on how to properly implement this, your help would be greatly appreciated. Thank you for any advice you can provide.