I'm trying to make a little animation but I'm failing to make it responsive, because "calc()" seems to not work with .animate. Is there another solution to this here?
if (time == 1) {
$("#message").animate({ marginTop: "calc(-15px + .8vw)" });
} else {
$("#message").animate({ marginTop: "calc(0px + .8vw)" });
}
With great and best regards, BERNARDO
EDIT: I'm trying to animate a message that appears on my website onchange() of a dropdown menu. It should be responsive so that's why I'm using calc().
<a>Time: </a><select id="time" onchange="setTime()" name="time" required>
<option value="1" selected>-</option>
<option value="3">-</option>
</select></br>
So is there like an alternative to make it responsive on another way without calc()?
calc(), it only understands numberscalc()doesn't work withanimate(), however I'm sure there's an alternative method for whatever it is you're trying to do. Could you please update the question to give details of what effect you're trying to achieve.