2A News

SCOTUS Startled by Reliance on Racist Laws to Defend ‘Vampire Rule’

Reading Time: 3:33 min

It’s said that the secret to seeing everything is simply living long enough. If that’s true, the U.S. Supreme Court listened to the claims of a lifetime this week as…

View post

Lynchburg Leaders Push for Second Amendment Sanctuary Status

Reading Time: 2:7 min

When a storm is coming, smart people prepare. They know to have fresh water, flashlights, generators, and other essential items for what lies ahead. The same holds for protecting our…

View post

Arizona Man Fatally Shoots Alleged Intruder

Reading Time: 1:58 min

Word will spread at some point that it is unwise to break into another person’s home in the U.S. With hundreds of millions of firearms in law-abiding citizens’ hands and…

View post

Security Guard Cleared in Fatal Self-Defense Shooting of Armed Woman

Reading Time: 1:53 min

A Michigan security guard is in the clear after a shooting claimed the life of a young woman. According to Southfield Police Chief Elvin Barren, 33-year-old Alexandra Fields was involved…

View post

California Man Finds Alleged Intruder, Fires in Self-Defense

Reading Time: 1:60 min

Imagine returning to your home just before midnight and finding an armed stranger inside. This scenario would be unsettling in any case and possibly tragic if you did not have…

View post

Fifth Circuit Rules Machine Guns Not Protected by Second Amendment

Reading Time: 1:55 min

The U.S. Court of Appeals for the Fifth Circuit on Tuesday issued a unanimous ruling rejecting a constitutional challenge to the federal ban on machine guns manufactured post-1986. The Gun…

View post
<script>
  /*Source: https://github.com/Krzysztof-Antosik/Two-direction-Sticky-Sidebar*/
  
  // Verificar el ancho de pantalla al cargar y redimensionar
  function checkScreenWidth() {
    if (window.innerWidth <= 767) {
      // Si la pantalla es menor o igual a 676px, no ejecutar el código
      return;
    }

    const stickyElement = document.querySelector('.fb-sidebar__aside');
    const startPosition = stickyElement.getBoundingClientRect().top;

    let endScroll = window.innerHeight - stickyElement.offsetHeight - 500;
    let currPos = window.scrollY;
    let screenHeight = window.innerHeight;
    let stickyElementHeight = stickyElement.offsetHeight;
    let topGap = 40;
    let bottomGap = 40;

    setTimeout(() => {
      if (stickyElement.hasAttribute('data-top-gap')) {
        const dataTopGap = stickyElement.getAttribute('data-top-gap');
        topGap = dataTopGap === 'auto' ? startPosition : parseInt(dataTopGap);
      }

      if (stickyElement.hasAttribute('data-bottom-gap')) {
        bottomGap = parseInt(stickyElement.getAttribute('data-bottom-gap'));
      }
    }, 100);

    stickyElement.style.position = 'sticky';
    stickyElement.style.top = `${topGap}px`;
    stickyElement.style.height = 'fit-content';

    function positionStickySidebar() {
      endScroll = window.innerHeight - stickyElement.offsetHeight - bottomGap;
      const stickyElementTop = parseInt(stickyElement.style.top.replace('px', ''));

      if (stickyElementHeight + topGap + bottomGap > screenHeight) {
        if (window.scrollY < currPos) {
          if (stickyElementTop < topGap) {
            stickyElement.style.top = `${stickyElementTop + currPos - window.scrollY}px`;
          } else if (stickyElementTop >= topGap && stickyElementTop !== topGap) {
            stickyElement.style.top = `${topGap}px`;
          }
        } else {
          if (stickyElementTop > endScroll) {
            stickyElement.style.top = `${stickyElementTop + currPos - window.scrollY}px`;
          } else if (stickyElementTop < endScroll && stickyElementTop !== endScroll) {
            stickyElement.style.top = `${endScroll}px`;
          }
        }
      } else {
        stickyElement.style.top = `${topGap}px`;
      }
      currPos = window.scrollY;
    }

    function stickyElementToMe() {
      stickyElement.style.top = `${topGap}px`;
    }

    function updateSticky() {
      screenHeight = window.innerHeight;
      stickyElementHeight = stickyElement.offsetHeight;
      positionStickySidebar();
    }

    setTimeout(() => {
      window.addEventListener('resize', () => {
        currPos = window.scrollY;
        updateSticky();
      });

      document.addEventListener('scroll', updateSticky, {
        capture: true,
        passive: true
      });
    }, 1000);
  }

  // Verificar el ancho de pantalla al cargar y redimensionar
  window.addEventListener('load', checkScreenWidth);
  window.addEventListener('resize', checkScreenWidth);
</script>