I have this in CSS :
#box:target {
box-shadow: 0px 0px 20px black;
}
On a "parent" page (page1), I have a button that makes you go to another page : "page2.html#box". So the #box:target is applied when I the page is loaded.
But with a button on the page1, I activate a function which purpose is to change the #box:target properties. I'm looking for a way to change this in javascript. Not :focus.
box-shadow property, after activate a functioncan you please elaborate it:targethas nothing to do with focusing. Are you asking about focusing or targetting?:focusor:hover. If you want a smoother animation and to avoid a repaint, I would suggest setting your additionnal box-shadow on the pseudo elements:beforeand animating it (see How to animate box-shadow)