2A News

Gunmaker Abandons Virginia for Greener Pastures in Georgia

Reading Time: 2:9 min

There should be penalties for states that run roughshod over Second Amendment rights, but litigation can take years, and there’s always the chance that anti-gunners will prevail. There is, however,…

View post

Armed Nashville Barbershop Customer Survives Foolish Threat

Reading Time: 1:60 min

Barber shops are a hub of activity in many communities, and often they are filled with old men waiting on a haircut and shave. What they are not supposed to…

View post

Hero California Father Protects Family and Kills Armed Suspect 

Reading Time: 1:54 min

Imagine visiting neighbors during a perfectly normal night and suddenly hearing gunfire and screams coming from your home. Your teenage daughter is inside, as is your wife, who just walked…

View post

DOJ Targets Philly Police Over Carry Permit Cancellations

Reading Time: 1:59 min

The Department of Justice (DOJ) put the Philadelphia Police Department (PPD) on notice this week following multiple complaints over arbitrary revocations of carry permits. On Tuesday, the DOJ Civil Rights…

View post

Battle Lines Expanding in Controversy over 3D-Printed Firearms

Reading Time: 2:0 min

The latest scheme by anti-gunners, even as the U.S. Supreme Court and Department of Justice warm to the concept of Second Amendment rights, is to go after homemade weapons. For…

View post

Virginia Authorities Retreat After Admonishment from Court

Reading Time: 1:57 min

A court order is not something to be taken lightly, even if you are politically powerful and have a rabid base that you constantly need to appease. This hard lesson…

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>