Skip to content Skip to sidebar Skip to footer

How To Edit 'clip' Css Property In Jquery?

I need to edit this 'clip' CSS property: #bulb_light { position: absolute; clip:rect(260px, 160px, 260px, 0px); } But not normally, rather, thanks to Jquery's help, so I tri

Solution 1:

Just a minor issue, you can't put a semi-colon at the end of the CSS value for this to work:

$("#bulb_light").css('clip', function () {
    return'rect(' + newy + 'px, 160px, 260px, 0px)'/* <-- Removed semicolon */;
});

Additionally, I'm not sure where newy is defined, you may not need a function callback for this unless newy is to be calculated for each element:

$("#bulb_light").css('clip', 'rect(' + newy + 'px, 160px, 260px, 0px)');

Post a Comment for "How To Edit 'clip' Css Property In Jquery?"