1

I have some code that looks like this:

$("#discription").css({'left', '500px + $(current).width();'});

$(current) is an image that is always changing. When it has a width of 50px for example, I would like 'left' to have the value of 550px.

Thanks

2 Answers 2

3

You should be able to add 500 to the current width, then concatenate the "px;"

$("#discription").css({'left', (500 + $(current).width()) + 'px'});
Sign up to request clarification or add additional context in comments.

Comments

2

Try this:

var leftWidth = 500 + $(current).width();
leftWidth += "px";
$("#discription").css({'left', leftWidth});

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.