Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][CSS] Ukrywanie pseudoelementu za pomocą JS
stellatus
post
Post #1





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 9.03.2017

Ostrzeżenie: (0%)
-----


Kod
<div>
  <p class="g1-meta entry-meta entry-byline entry-byline-with-avatar">
    <span class="entry-author">
      <span class="entry-meta-label">von</span>
      <a href="#" title="Posts by Roman" rel="author">
        <img
          alt=""
          src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcS6001cC2ejbwzQndTn-VX7NCmhWbom3WH5TDdzhFHeotIhLKZV"
          class="avatar avatar-30 photo"
          width="30"
          height="30"
        />
        <strong>Roman</strong>
      </a>
    </span>

    <time
      class="entry-date"
      datetime="2020-02-19T19:14:24"
      title="Feber 19, 2020, 7:14 pm"
      >vor 3 Tagen</time
    >
  </p>
</div>
<div>
  <p class="g1-meta entry-meta entry-byline entry-byline-with-avatar">
    <span class="entry-author">
      <span class="entry-meta-label">von</span>
      <a href="#" title="Posts by Hidden" rel="author">
        <img
          alt=""
          src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcS6001cC2ejbwzQndTn-VX7NCmhWbom3WH5TDdzhFHeotIhLKZV"
          class="avatar avatar-30 photo"
          width="30"
          height="30"
        />
        <strong>Hidden</strong>
      </a>
    </span>

    <time
      class="entry-date"
      datetime="2020-02-19T19:14:24"
      title="Feber 19, 2020, 7:14 pm"
      >vor 3 Tagen</time
    >
  </p>
</div>
<div>
  <p class="g1-meta entry-meta entry-byline entry-byline-with-avatar">
    <span class="entry-author">
      <span class="entry-meta-label">von</span>
      <a href="#" title="Posts by Krycha" rel="author">
        <img
          alt=""
          src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcS6001cC2ejbwzQndTn-VX7NCmhWbom3WH5TDdzhFHeotIhLKZV"
          class="avatar avatar-30 photo"
          width="30"
          height="30"
        />
        <strong>Krycha</strong>
      </a>
    </span>

    <time
      class="entry-date"
      datetime="2020-02-19T19:14:24"
      title="Feber 19, 2020, 7:14 pm"
      >vor 3 Tagen</time
    >
  </p>
</div>

Kod
.entry-byline .entry-date::before {
    display: inline-block;
    width: 3px;
    height: 3px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 50%;
    content: "";
    background: currentColor;
}

Kod
function hideSelectedTimeBefore() {
    var x = document.querySelectorAll('a[title="Posts by Hidden"]');
    var i;
    for (i = 0; i < x.length; i++) {
        x[i].parentNode.parentNode.querySelector('time.entry-date').style.display = "none";
    }
}
hideSelectedTimeBefore()


https://codepen.io/rudolph-reti/pen/XWbNVGM

Przy autorze "Hidden", chciałbym ukryć tylko kropkę (pojawiającą się za nazwą autora), która jest pseudoelementem. Wiem jak ukryć element <time>, w której siedzi pseudoelement "::before", co pokazałem w załączonym kodzie, ale nie wiem jak usunąć sam pseudoelement.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 19:59