0

I want to change para-top :before left value via JQuery.

.para-top:before {
    left: 5%;
}

Expected Result:

.para-top:before {
    left: 284px;
}

.attr not working for CSS Left.

Sarath
  • 207
  • 1
  • 2
  • 7
  • 7
    Possible duplicate of [Selecting and manipulating CSS pseudo-elements such as ::before and ::after using jQuery](https://stackoverflow.com/questions/5041494/selecting-and-manipulating-css-pseudo-elements-such-as-before-and-after-usin) – str Apr 04 '18 at 11:27
  • $(this).attr('data-content','bar'); .attr is not working for a CSS change, It only work for DATA – Sarath Apr 05 '18 at 06:37

1 Answers1

0

You can't manipulate :before, because it's not technically part of the DOM and therefore is inaccessible by any JavaScript. But you can add a new class with a new :before specified.

$('.para-top').toggleClass('changed');

Hope this helps. Credits to: @Blazemonger