I need this code to, if #vid
is present, add 855px to its current width. If not, it should do nothing. I'm not sure how to get jQuery to add to an already existing number, but I'm sure it's pretty simple. Here is the code I have so far:
if ($("#vid").length) {
$("#img-container").width(+=855),
} else {
return false;
}
});
jQuerys methods do not support a +=
syntax (only exception: css strings
), you would need to write:
$("#img-container").width($("#img-container").width() + 855)
or
$("#img-container").css("width", "+=855");
You could try this:
if ($("#vid").length)
{
$("#img-container").width($("#img-container").width() + 855);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With