Is it possible to set the CSS of a pseudo-element dynamically?

4.666665
Average: 4.7 (3 votes)
Reputation: 38
Asked 2 years ago.
286 View(s)
Is it possible to set the CSS of a pseudo-element dynamically?

Is it possible to set the CSS of a pseudo-element dynamically? For example:

jQuery dynamically styling help container

$('#help').css({ "width" : windowWidth - xOffset, "height" : windowHeight - yOffset, "bottom" : -windowHeight, "left" : 200 });

jQuery Attempt at setting the inner border of the help container:

$('#help:before').css({ "width" : windowWidth - xOffset, "height" : windowHeight - yOffset });

CSS file for the above

#help { opacity: 0.9; filter:alpha(opacity=90); -moz-opacity: 0.9; z-index: 1000000; bottom: -550px; left: 400px; background-color: #808080; border: 5px dashed #494949; -webkit-border-radius: 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px; border-radius: 20px 20px 20px 20px; } #help:before { border: 5px solid white; content: ''; position: absolute; -webkit-border-radius: 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px; border-radius: 20px 20px 20px 20px; }

Delivery Time: 3 days.
Question Category: CMS.
Farhan Muhammad
Reputation: 112
Free
Deliver in: 3 days

Tutor Answer

You must be login to view answer.