我希望能够在按下某个键时更改特定类的 css 属性。在此示例中,我想将 css 属性animation-play-state
从按下时更改running
为。以下(毫不奇怪,我在 jQuery 上是垃圾)不起作用:paused
spacebar
$(document).bind("keypress", function(e) {
if (e.keyCode == 49) {
$('.object').css('animation-play-state', 'paused')
};
});
谁能引导我走上正确的道路?谢谢!